Class and Object Example: Initialization through reference
Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)
2370Program:
// Save it as File name : Student2.java //Object and Class Example: Initialization through reference class Student{ int rollno; String name; } class Student2{ public static void main(String args[]){ Student s1=new Student(); s1.rollno=101; s1.name="last Boy"; System.out.println(s1.rollno+" "+s1.name);//printing members with a white space } }
Output:
101 last Boy Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.