Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

Why does Netbeans declare class name, and then another class name?

 
drew taylor
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why does Netbeans declare class name, and then another class name/method() before the public static viod main (String[] args)?

Would it work if you just had? Whats the class ClassName() for? It looks like a method?

public class ClassName {

public static voud main (String[] args) {
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Report post to moderator
Do you mean something like thisThe MyClass 'method' you are talking about is a constructor. Netbeans probably creates a simple no arg constructor for you when you create a class. You can probably configure it not to do that.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Report post to moderator
And by the way, if you are not sure about the basic parts of the language, you are probably better off avoiding IDEs like Netbeans and using a simple text editor and the command line compiler to create your programs. IDEs do a lot of things for you automatically, which is good if you know the language, but confusing if you don't. Go thru the Java Basics Tutorial first before using an IDE. It will all make a lot more sense then
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Report post to moderator
As far as I can tell, this is a duplicate of http://www.coderanch.com/t/408214/java/java/Netbeans-java-source-files
 
    Bookmark Topic Watch Topic
  • New Topic