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
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.
***********************************************************************************************
***********************************************************************************************
import java.io.*;
public class student
{
int regno;
String name,grade,branch;
void read()
{
DataInputStream x=new DataInputStream(System.in);
try
{
System.out.println("Enter register number :");
regno=Integer.parseInt(x.readLine());
System.out.println("Enter student name :");
name=x.readLine();
System.out.println("Enter branch :");
branch=x.readLine();
System.out.println("Enter Grade :");
grade=x.readLine();
}
catch(Exception e)
{
}
}
}
class office extends student
{
int deptno;
void display()
{
DataInputStream x=new DataInputStream(System.in);
try
{
System.out.println("Enter department number :");
deptno=Integer.parseInt(x.readLine());
}
catch(Exception e)
{
}
System.out.println("Name ="+name);
System.out.println("Branch ="+branch);
System.out.println("Grade ="+grade);
System.out.println("Department Number ="+deptno);
}
}
class inherit
{
public static void main(String[] args)
{
office s1=new office();
s1.read();
s1.display();
}
}
===================================
Predict the output...OK???