Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
***********************************************************************************************
import java.io.*;
class student1
{
int rno;
String name, branch;
void get()
{
try {
DataInputStream x = new DataInputStream(System.in);
System.out.println("Enter Roll Number");
rno = Integer.parseInt(x.readLine());
System.out.println("Enter Name");
name = x.readLine();
System.out.println("Enter Branch");
branch = x.readLine();
} catch (Exception e) {
}
}
void display() {
System.out.println(" ");
System.out.println("=========================");
System.out.println("STUDENT DETAILS :");
System.out.println("-----------------");
System.out.println("Roll Number =" + rno);
System.out.println("Name =" + name);
System.out.println("Branch =" + branch);
}
}
class exam
{
int regno, mark;
void read() {
try {
DataInputStream x = new DataInputStream(System.in);
System.out.println("Enter Register Number");
regno = Integer.parseInt(x.readLine());
System.out.println("Enter mark");
mark = Integer.parseInt(x.readLine());
} catch (Exception e) {
}
}
void write() {
System.out.println("=========================");
System.out.println("EXAM DETAILS :");
System.out.println("--------------");
System.out.println("Register Number =" + regno);
System.out.println("Mark =" + mark);
}
}
class main1
{
public static void main(String args[]) {
student1 s = new student1();
exam e = new exam();
s.get();
e.read();
s.display();
e.write();
}
}
Enter Roll Number
1
Enter Name
Priyada
Enter Branch
Computer Science
Enter Register Number
746092
Enter mark
500
=========================
STUDENT DETAILS :
-----------------
Roll Number =1
Name =Priyada
Branch =Computer Science
=========================
EXAM DETAILS :
--------------
Register Number =746092
Mark =500
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
Refer Program to enter Student Details also.***********************************************************************************************
import java.io.*;
class student1
{
int rno;
String name, branch;
void get()
{
try {
DataInputStream x = new DataInputStream(System.in);
System.out.println("Enter Roll Number");
rno = Integer.parseInt(x.readLine());
System.out.println("Enter Name");
name = x.readLine();
System.out.println("Enter Branch");
branch = x.readLine();
} catch (Exception e) {
}
}
void display() {
System.out.println(" ");
System.out.println("=========================");
System.out.println("STUDENT DETAILS :");
System.out.println("-----------------");
System.out.println("Roll Number =" + rno);
System.out.println("Name =" + name);
System.out.println("Branch =" + branch);
}
}
class exam
{
int regno, mark;
void read() {
try {
DataInputStream x = new DataInputStream(System.in);
System.out.println("Enter Register Number");
regno = Integer.parseInt(x.readLine());
System.out.println("Enter mark");
mark = Integer.parseInt(x.readLine());
} catch (Exception e) {
}
}
void write() {
System.out.println("=========================");
System.out.println("EXAM DETAILS :");
System.out.println("--------------");
System.out.println("Register Number =" + regno);
System.out.println("Mark =" + mark);
}
}
class main1
{
public static void main(String args[]) {
student1 s = new student1();
exam e = new exam();
s.get();
e.read();
s.display();
e.write();
}
}
=========================================================================
Output :
Enter Roll Number
1
Enter Name
Priyada
Enter Branch
Computer Science
Enter Register Number
746092
Enter mark
500
=========================
STUDENT DETAILS :
-----------------
Roll Number =1
Name =Priyada
Branch =Computer Science
=========================
EXAM DETAILS :
--------------
Register Number =746092
Mark =500