Java Reference
In-Depth Information
Example for a class
public class Person {
String Name;
String color;
int age;
void eating(){
void hungry(){
void Walking (){
void Running (){
void sleeping(){
Creating Objects for a class
As we know objects are the instances of the classes. Creating a object is also known as
instantiating an object.
Java provides a new operator for creating object. New operator creates an object for
the specified class and also returns a reference for that created object. As this returns a
reference of class type therefore there is aneed to create a reference type variable so that
that can hold that reference.
Search WWH ::

Custom Search