Advertisement
Guest User

Constructor

a guest
Oct 17th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package student;
  7.  
  8. /**
  9.  *
  10.  * @author CSE_IT
  11.  */
  12. public class Student {
  13.     String name,dept,id;
  14.    
  15.     Student(String name, String id, String dept){        
  16.         System.out.println("Name: "+name);
  17.         System.out.println("ID: "+id);
  18.         System.out.println("Dept: "+dept);        
  19.         System.out.println("\n");
  20.     }
  21.    
  22.     public static void main(String[] args) {
  23.        
  24.         Student obj = new Student("Shuvo","1830150198","CSE");
  25.         Student obj2 = new Student("Riku","18301950","EEE");
  26.         Student obj3 = new Student("Rah","18301955","CSE");
  27.        
  28.        
  29.     }
  30.    
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement