import
java.io.*;
class
students
{
private int sno;
private String sname;
private int mark1,mark2,total;
students() throws Exception
{
BufferedReader br = new
BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Student
No : ");
sno =
Integer.parseInt(br.readLine());
System.out.print("Enter Student
Name : ");
sname = br.readLine();
System.out.print("Enter mark1
and mark2 : ");
mark1 = Integer.parseInt(br.readLine());
mark2 =
Integer.parseInt(br.readLine());
}
students(int no,String name,int m1,int
m2)
{
sno = no;
sname = name;
mark1 = m1;
mark2 = m2;
total = mark1 + mark2;
}
void putstud()
{
System.out.println("Sno :
" + sno);
System.out.println("Sname
: " + sname);
System.out.println("Mark1
: " + mark1);
System.out.println("Mark2
: " + mark2);
System.out.println("Total :
" + total);
}
public static void main(String args[])
throws Exception
{
students s1 = new students();
students s2 = new students(100,"Kirthika",90,80);
s1.putstud();
s2.putstud();
}
}
No comments:
Post a Comment