Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
updated
//JAVA LAB Q2-Write a Java Program to define a class, define instance methods for setting and retrieving values of instance variables and instantiate its object import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { Student s=new Student(); Student p=new Student(); Student q=new Student(); s.setData("Riddhi Verma",104,420); s.getData(); p.setData("Monika",105,323); p.getData(); q.setData("deepika",106,232); q.getData(); } } class Student { //instance variables String name; int rollno; int marks; //member functions void setData(String n,int r,int m) { name=n; rollno=r; marks=m; } void getData() { System.out.println("Name = "+name); System.out.println("Rollno = "+rollno); System.out.println("marks= "+marks); } }
run
|
edit
|
history
|
help
0
191fa07050(1(D))
pass
assign
JAVA # Karekök Hesaplama
Problem_rstring
patterns
1a
bubble sort
m-primes
x by stars