06-04-2011, 01:19 PM
Code:
//StudPack.java
package p;
public class StudPack
{
int id,m1,m2,tot;
String n;
public void getdata(int num,String name,int mark1,int mark2)
{
id=num;
n=name;
m1=mark1;
m2=mark2;
tot=m1+m2;
}
public void display()
{
System.out.println("\n*******Student's Details*******");
System.out.println("Roll no:"+id+"\nName="+n+"\nEnglish="+m1+"\nScience="+m2+"\nTotal="+tot);
}
}
OUTPUT
E:\3msc\veena>java Newarray
Enter limit
3
Enter the array
2
3
4
Array sum is 9