daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Feb 21st, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top