0% found this document useful (0 votes)
11 views28 pages

Java Programs for Addition and Student Details

The document contains code for a Java program that accepts student details like roll number, name, and branch as input. It also accepts exam registration number and marks as input. The program then displays the collected student details and exam details. The code defines classes for student, exam, and main to get input, display output, and run the program respectively.

Uploaded by

Dhanoop Bhaskar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views28 pages

Java Programs for Addition and Student Details

The document contains code for a Java program that accepts student details like roll number, name, and branch as input. It also accepts exam registration number and marks as input. The program then displays the collected student details and exam details. The code defines classes for student, exam, and main to get input, display output, and run the program respectively.

Uploaded by

Dhanoop Bhaskar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

dhanoopbhaskar@gmail.

com

/* program to add two integers*/

import [Link].*;

class addition

public static void main(String args[])

int num1,num2,sum;

try

DataInputStream x=new DataInputStream([Link]);

num1=[Link]([Link]());

num2=[Link]([Link]());

sum=num1+num2;

[Link](“Sum is “+sum);

catch(Exception e)

Page | 1
dhanoopbhaskar@[Link]

Page | 2
dhanoopbhaskar@[Link]

Page | 3
dhanoopbhaskar@[Link]

Page | 4
dhanoopbhaskar@[Link]

Page | 5
dhanoopbhaskar@[Link]

Page | 6
dhanoopbhaskar@[Link]

Page | 7
dhanoopbhaskar@[Link]

Page | 8
dhanoopbhaskar@[Link]

Page | 9
dhanoopbhaskar@[Link]

Page | 10
dhanoopbhaskar@[Link]

Page | 11
dhanoopbhaskar@[Link]

Page | 12
dhanoopbhaskar@[Link]

Page | 13
dhanoopbhaskar@[Link]

/*program to accept and print student details*/

import [Link].*;

class student

int rno;

String name,branch;

void get()

try

DataInputStream x=new DataInputStream([Link]);

[Link]("Enter rollnumber");

rno=[Link]([Link]());

[Link]("Enter Name");

name=[Link]();

[Link]("Enter Branch");

branch=[Link]();

catch(Exception e)

void display()

{
Page | 14
dhanoopbhaskar@[Link]
[Link]("");

[Link]("Student Details");

[Link]("Roll Number: "+rno);

[Link]("Name: "+name);

[Link]("Branch: "+branch);

class exam

int regno,mark;

void read()

try

DataInputStream x=new DataInputStream([Link]);

[Link]("Enter Reg. No");

regno=[Link]([Link]());

[Link]("Enter mark");

mark=[Link]([Link]());

catch(Exception e)

}
Page | 15
dhanoopbhaskar@[Link]
void write()

[Link]("");

[Link]("Exam Details");

[Link]("Reg no: "+regno);

[Link]("Mark: "+mark);

class main1

public static void main(String args[])

student s=new student();

exam e=new exam();

[Link]();

[Link]();

[Link]();

[Link]();

Page | 16
dhanoopbhaskar@[Link]

Page | 17
dhanoopbhaskar@[Link]

Page | 18
dhanoopbhaskar@[Link]

Page | 19
dhanoopbhaskar@[Link]

Page | 20
dhanoopbhaskar@[Link]

Page | 21
dhanoopbhaskar@[Link]

Page | 22
dhanoopbhaskar@[Link]

Page | 23
dhanoopbhaskar@[Link]

Page | 24
dhanoopbhaskar@[Link]

Page | 25
dhanoopbhaskar@[Link]

Page | 26
dhanoopbhaskar@[Link]

Page | 27
dhanoopbhaskar@[Link]

Page | 28

You might also like