Guest User

Untitled

a guest
Feb 21st, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. Code start from here:
  2.  
  3. This is it:-
  4.  
  5. class Student{
  6.  
  7. String name ;
  8. int age ;
  9. Student(String name, int age )
  10. {
  11. name=name;
  12. age =age ;
  13.  
  14. }
  15. void display()
  16. {
  17. System.out.println(name);
  18. System.out.println(age);
  19. }
  20. public static void main (String args[])
  21. {
  22. Student s1=new Student("Ram",23);
  23. s1.display();
  24.  
  25.  
  26. }
  27. }
  28.  
  29. I have been asked by my tutor to perform the task which is explained in question too.
  30. 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