Menu
Question Index
...

public class One {
     String msg;
    
    void setOne(String str1) {
        msg = str1;
    }
    String getOne() {
        return msg;
    }
    public static void main(String s[]) {
        One objone = new One();
        objone.setOne("ONE");
        System.out.print(objone.getOne());
    }
}


ONE
Some other output
Compilation Error
Runtime Error

Doubts

Problems

Topic: Calling A Class From Another Class In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App