1 / 6

Java basic concepts with details

Java Object-objects have States and behaviour. Example: a dog has States-color, name, Breed as well as behavior such as tail waving, barking, eating. An object is an instance of a class.<br><br>Class-a class can be defined as template/blueprint that describes the behavior/state the object of its type.<br>Methods A method is basically a behavior. A class can contain many methods. It is in methods in which the logic is written, data is manipulated and all actions are executed.

isharoyhr
Télécharger la présentation

Java basic concepts with details

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. basic concepts Object-objects have States and behaviour. Example: a dog has States-color, name, Breed as well as behavior such as tail waving, barking, eating. An object is an instance of a class. Class-a class can be defined as template/blueprint that describes the behavior/state the object of its type. Methods A method is basically a behavior. A class can contain many methods. It is in methods in which the logic is written, data is manipulated and all actions are executed.

  2. Java-Modifier Like other languages, it is possible to modify classes, methods etc. with modifiers. There are two categories of modifiers Access modifiers-Standard, public, protected, private Non-access modifiers-final, abstract, strictfp variables Below are the types of variables in Java Local Variables Class Variables (Static Variables) Instance variables (Non-static variables)

  3. Java Arrays Arrays are objects that store multiple variables of the same type. However, an array itself is an object on the heap. In the coming chapters we will examine how to declare, construct and initialize Java Enums Enums were introduced in Java 5.0. Enums restrict a variable to one of only a few predefined values. The values in this enumerated list are called enums. By using enums it is possible to reduce the number of errors in your code. For example, if we consider an application for a fresh juice store, it would be possible to limit the size of the glass to small, medium and large. This would ensure that it would not allow anyone to order a size other than small, medium or large.

  4. Inheritance In Java, classes can be derived from classes. If you need to create a new class and you already have a class that contains part of the code you need, you can derive your new class from the existing code. This concept allows you to reuse the fields and methods of the existing class without having to rewrite the code in a new class. In this scenario, the existing class is called the superclass and the derived class is the sub class Interface In Java, an interface can be defined as a contract between objects, how to communicate with each other. Interfaces play an important role when it comes to the concept of inheritance. An interface defines the methods that should use a derived class (subclass). But the implementation of the methods is totally up to the subclass

More Related