Advertisement
shawonrog

Overloading Constractor

Feb 26th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. package springpractice;
  2.  
  3. import springpractice.Constructor.*;
  4.  
  5. public class Overloading {
  6. public static class sc{
  7. String name,gender;
  8. long phone;
  9.  
  10. void setInfo(String n,String g,int p) {
  11. name=n;
  12. gender=g;
  13. phone=p;
  14. }
  15. void display() {
  16. System.out.println("Name: "+name);
  17. System.out.println("gender: "+gender);
  18. System.out.println("Phone Number: "+phone);
  19. }
  20. }
  21. public static void main(String[] args) {
  22. sc s=new sc();
  23. s.name="Dr.Md.Kamal Pasha";
  24. s.gender="Male";
  25. // s.phone=(long)17353793;
  26. s.display();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement