EE408 Lab 1: Running Java Programs with Eclipse
2%
Due: 5 PM, Friday August 29.
In a separate email, I have sent you two Java files, IntSet.java and Main.java. Save them onto the local
disk.
I will briefly demonstrate how to do the following tasks:
- Use Eclipse, as an editor, to view the two files.
- Set up the right directory structure for a Java application.
- Import the Java application into Eclipse as a Java Project and
run it.
You need to conduct the following tasks and demonstrate to me when you
finish.
1. Carry out the above on your machine so that you can run the program
from within Eclipse.
2. Modify Main.java such that
the input integers become 1, 2, 3, 3,
2, 3, in this order. Run the program to see the output.
3. You will notice that the number 3 is reported twice as being
duplicated. Add code so that duplicated numbers are reported once
and only once.
4. Remove the keyword "static"
from the definition of the field a
in class Main ("private static int
a[];"). What happens?
(Hint: although static fields and methods appear in the same class as
instance variables and methods, there is only one copy of static fields
at runtime and static methods can access only static fields. Knowing
this distinction is important for Swing programming.)
Note:
If you want to set up the Eclipse Java IDE on your own computer, you
may download it
from here
(by following the platform links on the right).