Classes and Objects in Java with examples

A class is a blueprint or model based on which object is defined. A class cannot exists in real world but object can. A class is a physical idea where as object is an instance of the class.

An object is an entity that is having state and behavior or simply we can say object is anything that exists in the real world. An object will have properties and actions. Properties are represented by variables and Actions are represented by methods.

java objects containing variables and methods
Objects in Java
  • If you take a dog it will have properties like name, height, weight, age and actions like barking, running, biting etc.
  • We can't create a object without a class.
  • However we can create a class without a object for example Dinosaur
  • A class is a physical idea where as object is instance of class
  • Class code is stored in method area in JVM where as
  • Objects are created in heap in JVM



Core Java Concepts

Hi folks,I would like to inform that who are working as a test enginners or going to start their career in testing or quality assurance or QA perspective be careful and you should remember things are getting changed rapidly and don't expect that you will be asked what is regression testing, what is quality assurance or what is retesting bla bla..  The trend is now getting changed and you will be asked to write the code also for any language that you are keeping in your resume. Incase of Java be prepare for Java coding, Java Naming Conventions, Java OOPS concepts like Inheritance, Polymorphism, Abstraction, Encapusulation, Exception handling, Multithreading, Swings 
JDBC or any such type of things you might be asked.

And if you are an automation experrise then you will be asked for system test also, where you need to sit and solve the given task or write code for that one.

Here is the list of Java Concepts I would like explain in detail which is useful for especially for test engineers.

1) Classes and Objects
2) Inheritance
3) Polymorphism
4) Abstraction
5) Encapsulation
6) Exceptional Handling
7) Multi threading