Question: 2. Point out the error(s) and how they can be fixed in the following code: public class OOPExercises { public static void main(String[] args) {

2. Point out the error(s) and how they can be fixed in the following code:

public class OOPExercises {

public static void main(String[] args) {

A objA = new A( );

double result;

result = objA.getA( );

System.out.println("objA.a = "+ result);

}

}

public class A {

private int a = 100;

public void setA( int value) {

a = value;

}

public int getA() {

return a;

}

} //class A

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the corrected code with explanations for the errors and fixes Java public class OOPExercises p... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!