- First create a class within the "secondAPP" package called "LabExercise2" and copy and paste the following code
package secondApp;
public class LabExercise2 {
public static void main(String[] args) {
LabExercise1 sample;
sample = new LabExercise1();
if (sample.c==4)
{
sample.printHello();
}
else
{
System.out.println("Whatever");
}
}
}
- Within "LabExercise2" editor window, place your cursor on "sample = new LabExercise1();" and right click it. From there, scroll down and click "Declaration"
- You should now see "LabExercise1" opened in the editor window with the method "LabExercise1()" highlighted. This essentially means the highlighted method is the declaration used in the other java class.