Home / DeveloperSection / Interviews / What is this in java?
You haven’t finished your post yet. Are you sure you want to leave and discard your draft?
Can you answer this question?
Anonymous User
class Student10{ int id; String name; Student10(int id,String name){ id = id; name = name; } void display(){System.out.println(id+" "+name);} public static void main(String args[]){ Student10 s1 = new Student10(111,"Karan"); Student10 s2 = new Student10(321,"Aryan"); s1.display(); s2.display(); } }
class Student11{ int id; String name; Student11(int id,String name){ this.id = id; this.name = name; } void display(){System.out.println(id+" "+name);} public static void main(String args[]){ Student11 s1 = new Student11(111,"Karan"); Student11 s2 = new Student11(222,"Aryan"); s1.display(); s2.display(); } }
You have need login or register for voting of answers or question.
Anonymous User
27-Mar-2015