Program:-
import java.util.Scanner;
public class student {
long student_id;
int subject_code,marks;
Scanner s=new Scanner(System.in);
void getdata()
{
System.out.println("Enter the student_id :");
student_id=s.nextLong();
System.out.println("Enter the subject_code:");
subject_code=s.nextInt();
System.out.println("Enter the marks:");
marks=s.nextInt();
}
void putdata()
{
System.out.println(" student_id :"+ student_id);
System.out.println("subject_code:"+subject_code);
System.out.println("marks:"+marks);
}
public static void main(String[] args) {
student s1=new student();
s1.getdata();
s1.putdata();
}
}
Output:-
import java.util.Scanner;
public class student {
long student_id;
int subject_code,marks;
Scanner s=new Scanner(System.in);
void getdata()
{
System.out.println("Enter the student_id :");
student_id=s.nextLong();
System.out.println("Enter the subject_code:");
subject_code=s.nextInt();
System.out.println("Enter the marks:");
marks=s.nextInt();
}
void putdata()
{
System.out.println(" student_id :"+ student_id);
System.out.println("subject_code:"+subject_code);
System.out.println("marks:"+marks);
}
public static void main(String[] args) {
student s1=new student();
s1.getdata();
s1.putdata();
}
}
Output:-
No comments:
Post a Comment