1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Veseljchak [2.6K]
3 years ago
9

Write a Student class in Java which has a name, id_number, year (e.g. 2) and

Computers and Technology
1 answer:
Fittoniya [83]3 years ago
8 0

Answer:

Following are the code in java

public class Student

{

// member variables

String name;

String id_number;

int year ;

String programme_code ;

// default constructor

public student()  //default constructor

{

name="san";

id_number="12";

year =2010;

programme_code="ECE";

}  

 // method to display the member variables of the Student

 public void display() // dispaly the value

{

System.out.println("Name is  : "+name);

System.out.println("ID is  : "+id_number);

System.out.println("Year is  : "+year);

System.out.println("Programme code is : "+programme_code);

  }

public static void main (String[] args) // Main method

{

 Student ob=new Student();

 ob.display(); // calling the method display  

}  

}

Explanation:

In this we create a class "student "  name,id_number, year and  programme_code are the variable after that create a default constructor and initialize the variable and finally display the variable .In the main method we create a object of student class i.e ob ,and call display method  with object ob.

Output:

Name is  :san

ID is  : 12

Year is  :2010

Programme code is : ECE

You might be interested in
An example of human API would be when:
liraira [26]

Answer:A

Explanation:Apex

8 0
3 years ago
Read 2 more answers
Complete the sentence with the correct response.
Fiesta28 [93]

Answer:

Material systems developer typically combines the skills of a programmer with the multitasking expectations of developing 3 dimensional models of objects, enhancing the graphical effects.

6 0
3 years ago
The two primary methods of memory allocation are:
levacccp [35]

Answer:

The answer is

Stack and heap

4 0
3 years ago
How do you change the name on your brainly account?
serg [7]

Answer:

For changing your username you can contact to administrator of the site. If you are using app then go to message option. Then search "rishilaugh" then you can message him. Hope it helps you!

8 0
4 years ago
Please help ASAP!
makkiz [27]
B. training is the correct answer
8 0
3 years ago
Other questions:
  • Local television news networks cover only
    8·2 answers
  • According to the article words have the power to change people's behavior. Describe one example of this from the article
    6·1 answer
  • Which signal types are represented by a continuous wave form?
    11·1 answer
  • The government department responsible for laws concerning work is the
    12·1 answer
  • Write the definition of a function named rotate4ints that is passed four int variables. The function returns nothing but rotates
    9·1 answer
  • A web ______ is a computer that delivers requested webpages to your computer or mobile device.
    7·1 answer
  • Laura has many online accounts discuss the privacy concerns associated with individuals use of the Internet
    15·1 answer
  • 334. Universal Containers uses a custom field on the account object to capture the account credit status. The sales team wants t
    12·1 answer
  • Based on what you know about the Sort and Find functions, return to the database file to determine the answers to the following
    7·2 answers
  • A _____ is an Access database object that allows you to arrange the fields of a record in any layout so you can enter, edit, and
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!