Monday, 16 September 2019

Simple Program for creating object in JAVA.

                        Java Program for Object Creation



1. Open notepad file.
2. Write the code given below in notepad.

class Student
{
String name;
String age;
public static void main(String arg[])
{//Creating Object of Student class
Student  obj= new Student(); // calling default constructor while creating object
System.out.println("Default Name of Object "+obj.name);
System.out.println("Default Age of Object "+obj.age);
}

}



3. Save the file with Student.java.


4. Compile and run the code using javac and java command on command prompt.





No comments:

Post a Comment

EMPLOYABILITY SKILLS – PRACTICAL FILE

 ðŸŒŸ EMPLOYABILITY SKILLS – PRACTICAL FILE --- S. No. Title of Practical / Activity 1. Preparation of a Professional Resume in Proper For...