Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code start from here:
- This is it:-
- class Student{
- String name ;
- int age ;
- Student(String name, int age )
- {
- name=name;
- age =age ;
- }
- void display()
- {
- System.out.println(name);
- System.out.println(age);
- }
- public static void main (String args[])
- {
- Student s1=new Student("Ram",23);
- s1.display();
- }
- }
- I have been asked by my tutor to perform the task which is explained in question too.
- I have been asked to assign value to instance data member(name,age) without using this keyword or creating new object.
Add Comment
Please, Sign In to add comment