Difference between revisions of "Team2/Navigate to a Java Element's Declaration"

From CDOT Wiki
Jump to: navigation, search
(Created page with 'kjkj')
 
 
Line 1: Line 1:
kjkj
+
=Guide Line=
 +
*First create a class within the "secondAPP" package called "LabExercise2" and copy and paste the following code
 +
<pre>
 +
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");
 +
        }
 +
 
 +
    }
 +
}
 +
</pre>
 +
 
 +
*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.
 +
 
 +
*[http://zenit.senecac.on.ca/wiki/index.php/Team2/Viewing_the_Type_Hierarchy Click here] to progress to the next tutorial

Latest revision as of 22:57, 2 February 2011

Guide Line

  • 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.