shawonrog

constractor

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