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
With a C program (memory map), data in _____ is initialized by the kernel to arithmetic 0 or null pointers before the program st
jolli1 [7]

Answer:

The answer is "  Uninitialized data segment ".

Explanation:

It (memory map) field whenever a C program is locked to run, the kernels must allocate information into 0 or null pointer in this section until the process runs. This variable, that is outside of any function, has been stored in uninitialized data item by the C statement (like, "long amount[1000];").  

If we did not declare the data segment, it also called bss, in which all block which begins with the symbol and is called for an old assembly language operator.

3 0
3 years ago
Which of the following is Tynker an example of?
dangina [55]

Answer:

binary code

Explanation:

correct me if i’m wrong :)

6 0
3 years ago
Read 2 more answers
Write a program in main.c that reads the file lorum.txt and counts the number of characters on each line. Your program should cr
Aneli [31]

Answer:

A C programming language was used to write a file lorum.txt and counts the number of characters on each line.

Explanation:

Raw_Code :

#include<stdio.h>

int main(){

  FILE *read,*write;       //creating file pointers

  int line=1,count=0;

  char ch;

  read = fopen("lorum.txt","r");   //opening files to read and write

  write = fopen("count.txt","w");

  while((ch = getc(read))!=EOF){       //reading lines until end of the file

      if(ch == '\n'){                   //if new line character encountred

          fprintf(write,"%d: %d\n",line,count);       //Then printing count of that line to file  

          line++;                       //incrementing the count of lines

          count = 0;                   //making characters count to 0

      }

      else{

          count++;           //if it is not new line character then increasing character count

      }

  }

  fprintf(write,"%d: %d",line,count);   //writing last lines count to count.txt

  fclose(read);

  fclose(write);

  return 0;

}

4 0
3 years ago
Documents stored on the world wide web are written and linked together using
FrozenT [24]
Using the hypertext transfer protocol
3 0
3 years ago
Please someone participate in my typing race ...
dsp73

Answer:

what is typing race

this link can not be clicked

8 0
3 years ago
Other questions:
  • A network administrator wants to have the same network mask for all networks at a particular small site. The site has the follow
    11·1 answer
  • Write a for loop that displays the following set of numbers: 0,10,20,30,40,50....1000
    10·1 answer
  • What is the purpose of the print area feature​
    11·1 answer
  • Operating software is a must in every software (a) True (b) False
    8·1 answer
  • Before you enter an intersection on a green light make sure
    14·2 answers
  • A crane is attempting to lift a beam that exceeds its load rating. What type of accident is possible?
    9·1 answer
  • Whers the main characteristic of a Peer-to-peer (P2P) network?
    14·1 answer
  • Rey is recording the dialogues and sound effects separately in the studio, as he is not happy with the sound quality recorded on
    9·1 answer
  • Pls help help me is good help me helping is very good
    10·1 answer
  • Is windows CUI operating system??<br><br><br>What is the main purpose of folder ????<br><br><br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!