[program-java] Eclipse: Creating a Class

  • From: "Corbett, James" <James.Corbett@xxxxxxxxxxxxx>
  • To: "Program-J (E-mail)" <program-java@xxxxxxxxxxxxx>
  • Date: Tue, 21 Oct 2008 12:13:49 -0400

Eclipse: Creating a Class

Ok, so far we have created a workspace, and a package.... In the real world of 
Java, we haven't accomplished much. In fact, all that we have done is useless. 

Therefore, lets make this thing a thing....

Therefore, we are going to create a class.... A class is a template for a 
thing.... A thing is an object and objects have attributes and properties.

1.      Again, from the File\New\ menu, select Class....

2.      A new screen will appear and you are prompted for a name for your 
class... In the java language all classes start with a capitol letter so in our 
example we will call it Main... Note the capitol M.

3.      Since our example is of a MVC (Multi View Controller we have a start up 
class Main which will be in the package main with a lower case m....

4.      In order to denote this class as our main start up we must first add a 
few things:

5.      Once you have entered the class name, tab until you reach "public 
static void main (String[] args)" and select the check box....
Continue tabbing until you locate the Finish button.

6.      If you view your project explorer and note that the class file is not 
in the main package, you can right click the file, locate Refactor\Move and 
then move the file into the corresponding package.



James M. Corbett

GST Division (Micro Applications)
Acting CS3 IT Specialist / Acting Team Leader
(613) 941-1338

"I love deadlines. I like the whooshing sound they make as they fly by." 
Douglas Adams

"I'm Jim Corbett and I approve this message"

Other related posts: