ONLINE SUMMER TRAINING Online Courses Free Tutorials 
 Placement Preparation 
Artificial Intelligence(AI) & Machine Learning(ML) Training in Jaipur
0 like 0 dislike
in VTU B.Tech (CSE-IV Sem) Design and Analysis of Algorithm Lab by Goeduhub's Expert (5.8k points)

Create a Java class called Student with the following details as variables within it.

  • USN
  • Name
  • Programme
  • Phone

Write a Java program to create n Student objects and print the USN, Name, Programme, and Phone of these objects with suitable headings.

Goeduhub's Online Courses @Udemy

For Indian Students- INR 570/- || For International Students- $12.99/-


Course Name

Apply Coupon


Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon


Computer Vision with OpenCV | Deep Learning CNN Projects

Apply Coupon


Complete Machine Learning & Data Science with Python Apply Coupon


Natural Language Processing-NLP with Deep Learning in Python Apply Coupon


Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon


Complete Python Programming from scratch with Projects Apply Coupon

1 Answer

0 like 0 dislike
by Goeduhub's Expert (5.8k points)
edited by
Best answer

For Theory of Classes and Objects Click here

Program Code


class Student


 String usn, name, programme;

 long ph;



 usn = name = programme = "No value";

 ph = 0;


 void read_data(String u, String n, String p, long m)


 usn = u;

 name = n;

 programme = p;

 ph =m;

 }void display()


 System.out.println(usn + "\t" + name + "\t" + programme + "\t\t" + ph);



class Record


 public static void main(String args[]) throws Exception


 String u, n, p;

 long m;

 int no;

 BufferedReader br = new BufferedReader(new InputStreamReader(;

 System.out.print("Enter number of records:");

 no = Integer.parseInt(br.readLine());

 Student[] s = new Student[no];

 for(int i=0; i<s.length;i++)


 System.out.println("\nEnter Student " + (i + 1) + " record");

 s[i] = new Student();

 System.out.print("Enter student USN: ");

 u = br.readLine();

 System.out.print("Enter student Name: ");

 n = br.readLine();

 System.out.print("Enter student Programme: ");

 p = br.readLine();

 System.out.print("Enter student Phone number: ");

 m = Long.parseLong(br.readLine());

 s[i].read_data(u, n, p, m);


 System.out.println("USN \t NAME \t PROGRAMME \t PHONE NO");

 for(int i=0; i<s.length;i++)








For more VTU IV Sem DAA Lab Experiments Click here

Our Mentors(For AI-ML)

Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune


Ms. Nisha

An alumna of IIT-BHU

Related questions


About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © Social::   |  |