Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Student {
- String name;
- int roll;
- @Override
- public String toString() {
- return "Student [name=" + name + ", roll=" + roll + "]";
- }
- }
- class Helper {
- Student s;
- int x;
- Helper(Student s, int x) {
- this.s = s;
- this.x = x;
- }
- void change() {
- x = 999999;
- s.name = "Unknown";
- s.roll = 999999;
- }
- }
- public class PBVPBRTest {
- public static void change(Student s) {
- s.name = "Kune";
- s.roll = 962349;
- }
- public static void main(String[] args) {
- int x = 12;
- Student s = new Student();
- s.name = "Mohith";
- s.roll = 411641;
- // change(s);
- Helper h = new Helper(s, x);
- h.change();
- System.out.println(s);
- System.out.println(x + "");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement