![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 148
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#2 |
|
Professional Programmer
|
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|