Class Basics
Answer the following questions regarding the following class.
a. What are the instance variables?
b. Which methods are public and which are private?
c. What is the name of the class?
d. What is the name of an object of this class?
e. Is MyClass.tryMe(); a legal statement?
f. Is MyClass.tryMeToo(); a legal statement?
g. Determine the output.
class MyClass{private int var1, var2;private String var3, var4;static private int count; public MyClass() { Count++; } private void myMethod() { System.out.println("MyMethod"); } String tryMe(String x) { System.out.println(++ var1); System.out.println (++ var2 + var1); System.out.println (var3 + "link " + var4) ; return("tryMe " + x); } static void tryMeToo() { for (int j = 0; j public static void main(String[] args) { MyClass x = new MyClass(); System.out.println(x.tryMe("fi rst try")); x.tryMeToo(); MyClass y = new MyClass(); x.tryMeToo(); y.tryMeToo(); }}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.