• Source
    1. class student
    2. {
    3. String USN,NAME,BRANCH,PH;
    4. student(String U,String N,String b,String p)
    5. {
    6. this.USN=U;
    7. this.NAME=N;
    8. this.BRANCH=b;
    9. this.PH=p;
    10. }
    11.  
    12. void display()
    13. {
    14. System.out.println("\nEnter the students detail");
    15. System.out.println("USN="+this.USN);
    16. System.out.println("Name="+this.NAME);
    17. System.out.println("Branch="+this.BRANCH);
    18. System.out.println("Phone No="+this.PH);
    19. }
    20. }
    21. public class lab1a
    22. {
    23. public static void main(String[]args)
    24. {
    25. student ob1=new student("CS112","xxx","CSE","119");
    26. student ob2=new student("CS132","yyy","CSE","118");
    27. student ob3=new student("CS098","zzz","CSE","117");
    28. ob1.display();
    29. ob2.display();
    30. ob3.display();
    31. }
    32. }class student
    33. {
    34. String USN,NAME,BRANCH,PH;
    35. student(String U,String N,String b,String p)
    36. {
    37. this.USN=U;
    38. this.NAME=N;
    39. this.BRANCH=b;
    40. this.PH=p;
    41. }
    42.  
    43. void display()
    44. {
    45. System.out.println("\nEnter the students detail");
    46. System.out.println("USN="+this.USN);
    47. System.out.println("Name="+this.NAME);
    48. System.out.println("Branch="+this.BRANCH);
    49. System.out.println("Phone No="+this.PH);
    50. }
    51. }
    52. public class lab1a
    53. {
    54. public static void main(String[]args)
    55. {
    56. student ob1=new student("CS112","xxx","CSE","119");
    57. student ob2=new student("CS132","yyy","CSE","118");
    58. student ob3=new student("CS098","zzz","CSE","117");
    59. ob1.display();
    60. ob2.display();
    61. ob3.display();
    62. }
    63. }