This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Why does Netbeans declare class name, and then another class name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

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

drew taylor
Greenhorn

Joined: Feb 20, 2006
Posts: 21
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

Joined: Aug 05, 2005
Posts: 3429
    
  12
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
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3429
    
  12
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

Joined: Jul 11, 2001
Posts: 14112
As far as I can tell, this is a duplicate of http://www.coderanch.com/t/408214/java/java/Netbeans-java-source-files


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why does Netbeans declare class name, and then another class name?
 
Similar Threads
Static Variable Problem
java
not compiling
query about overridden method
why public came to picture