OOPS concepts in Java
Java tutorials for beginners
Java basics concepts
Java Objects and Classes
What is Inheritance in Java?
What is Abstraction in Java?
What is Interface in Java?
What is Abstract Class in Java?
What is Polymorphism in Java?
What is Encapsulation in Java?
Java programming example
How Java Program Work?
Hello World in Java
Java basics for beginners
1. Objects:
Object is an instance of a class and entity that has state and behaviour e.g. pencil, book, table, car. State is value of an object and behaviour is functionality of an object such as writing.
2. Classes:
Class is a template or blueprint that describe the
behaviours and states of a particular entity. A class defines new data type and
can be used to create object of that type.
A class is declared using class keyword and it can be either abstract, final or default normal class.. The variables defined within a class are called instance variables and instance variables and methods are known as class members.
A class is declared using class keyword and it can be either abstract, final or default normal class.. The variables defined within a class are called instance variables and instance variables and methods are known as class members.
Class declarations can include following order
o
Modifiers : A class can be
public or default access specifier.
o
Class name: The name should begin with a
initial capital letter.
o
Super class: Can use extends keyword for
inherit.
o
Interfaces: Can use comma separated
implements keyword for inherit.
o
Body
: The class body
surrounded by braces, { }.
Example:
public class Student {
String name;
String rollNo;
int age;
String address;
}
Here Student is a class and name, rollNo, age, address are properties of Student class.
3. Instance:
An instance is
a copy of a Class that representing an Object. When a new instance of a class
is created, the JVM will allocate memory for that class instance.
Example of
create instance of class.
Student std = new Student();
Here std is instance of Student class, new
keyword creates the physical copy of the object and assign it to
the std variable.
Really very good article. the post has excellent tips which are very useful.
ReplyDeletelaptop price
Really very good article. the post has excellent tips which are very useful.
ReplyDeletelaptop price
Excellent Post. Are you looking for Laptops for your training? Click here Laptop Price to select your idle Laptop in budget.
ReplyDeleteThanks for sharing informative post.
ReplyDeletejava training
<a href="www.nettechindia.com/core-java-training/>java course</a>