• Post Reply Bookmark Topic Watch Topic
  • New Topic

Howdy, ranchers and greenhors! Simple&Small question about Class creation in NetBeans IDE  RSS feed

 
iustina istrati
Greenhorn
Posts: 1
Firefox Browser Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all:

new to Java, new to the forum and doing a self study in Java at the moment. I am using the Murach Java edition 4 and got stuck in Chapter 7 at class creation. I am using the NetBeans IDE v 8.0.2. I followed the steps that Murach indicates in the book as well as watched a youtube video courtesy of Saurabh Amin. So, in a nut shell this is what I did:

I created a New Project without a main class. I right clicked on the New Project and choose New > Java Class. NetBeans dutifully creates a new filename.Java file in the default source folder but when I open it, it does not automatically fill it with a class template (I checked and the template is not blank in the IDE). Feels like I am missing something and cannot put my finger on it.

An suggestions on how I should proceed? Fell completely stuck as this is a major point in Java programming and I am not able to move forward.

Happy Holidays!

thank you in advance,
iustina
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Netbeans IDE, once you deselect the creation of a main class for the newly created project, its up to you the developer to determine which class will be designated as the main class within the project...

To designate any class as a candidate for being the main class, simply add the Java entry point stub to the class which is the main method...

The main methods looks like the following:
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Your question is really an IDE question and not a Java question, unfortunately I don't use NetBeans so can't advise but others here do, so maybe one of them will be able to give you specific advise.

On a more general note: I'm not entirely sure what you mean by "it does not automatically fill it with a class template", do you mean it doesn't add the package name, class name and opening and closing braces? If so I don't see why this means you are stuck, can't you just type the information in yourself?

BTW as I said earlier this isn't a Java programming issue it's an IDE issue - you can easily write Java class files using something a simple as Notepad and in fact when starting out learning to program it is advisable to use a basic editor rather than an IDE as it teaches you a lot more about classpaths, compilation etc, it also means you can concentrate on learning Java and not have to use half your brain power to learn an IDE at the same time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!