Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   Different IDE's Different code (http://www.programmingforums.org/showthread.php?t=2947)

357mag Mar 26th, 2005 3:04 PM

Different IDE's Different code
 
I've tried Eclipse and after creating a new project I've typed this in the code window:

public class Welcome{
public static void main(String args[])
{
System.out.println("Welcome to Java!");
}
}

When I run the program it outputs "Welcome to Java!".

Now when I try a different IDE like NetBeans that IDE adds a little more code to the code window so now it looks like this:

public class Welcome {

/** Creates a new instance of Welcome */
public Welcome() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Welcome to Java!");
}
}

So it appears that NetBeans has added public Welcome() to the code. I'm not sure but I think that is called a constructor? Why does one IDE not show that and another IDE will show that? Is that something I need to know about right away or can I just not worry about it when just starting out? I know that books don't have you type that in.

Dizzutch Mar 26th, 2005 3:42 PM

templates IDE use are different depending on who wrote them. Netbeans adds a constructor for ease, because most classes will have a constructor. Eclipse doesn't because they figure you can ad one yourself. I'm pretty sure these templates are customizable, so if you don't like 'm you can change 'm. You'll need to know about constructors if you want to program in Object Oriented fashion, like with Java, or C++.
Dizz


All times are GMT -5. The time now is 4:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC