Advertisement
shawonrog

static

Feb 26th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package springpractice;
  2.  
  3. import springpractice.Constructor.sc;
  4.  
  5. public class Static {
  6.  
  7. public class student{
  8. String name;
  9. int id;
  10. static String universityName="DIU";
  11.  
  12. public student(String n,int i) {
  13. name=n;
  14. id=i;
  15. }
  16.  
  17. void display() {
  18. System.out.println("Name: "+name);
  19. System.out.println("ID: "+id);
  20. System.out.println("University Name: "+universityName);
  21. }
  22. }
  23. public static void main(String[] args) {
  24. student s1=new student("Anisul",101);
  25. student s2=new student("Mohaiminul",102);
  26. s1.display();
  27. s2.display();
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement