• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write all clases in just one Tab in Net Beans  RSS feed

 
Kaspersky Ukshini
Ranch Hand
Posts: 122
C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, can you please help me find a way to make all my clases in one single tab and not like this:
http://prntscr.com/4ypmzl

because at the end of the exam, we have to paste the whole code (as one) in a specified web page, which instantly shows us the result. We need the whole code to be in just one page (like back in C++).
Can you please help me that, and avoid problems?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've not used netbeans in years, so I can't address that, but as a short term solution, couldn't you paste each tab into a notepad page, appending each. Then, once all are in there, you can select it all at once?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bashkim Ukshini wrote:at the end of the exam, we have to paste the whole code (as one) in a specified web page

I don't know which exam you are talking about but if all your code is on one page how does it check that all public top level classes were created in a file with the same name as the class ?
 
Kaspersky Ukshini
Ranch Hand
Posts: 122
C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the system they impleneted:
http://prntscr.com/4yqt8o

As long as others are doing it, and the faculty made it that way, it has to be a way around it.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bashkim Ukshini wrote:That's the system they impleneted:
http://prntscr.com/4yqt8o

I'm not sure what that was supposed to demonstrate but all I could see was a main method.

Java is designed to have each top level class in a separate file and Netbeans (and probably most IDEs) is designed to show different files in different tabs, so if you want to join all your files together I think Fred's suggestion is probably going to be the best answer you will get.
 
Kaspersky Ukshini
Ranch Hand
Posts: 122
C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:
Bashkim Ukshini wrote:That's the system they impleneted:
http://prntscr.com/4yqt8o

I'm not sure what that was supposed to demonstrate but all I could see was a main method.

Java is designed to have each top level class in a separate file and Netbeans (and probably most IDEs) is designed to show different files in different tabs, so if you want to join all your files together I think Fred's suggestion is probably going to be the best answer you will get.


That was not the full code, it was just the space were the code is pasted once you finish the problem, and you just click submit and the system tests it out.
The system has ONLY ONE class package in it, which they tell you at the start, giving you it's name..and you just have to use that one class to code the program, but there is a way to use other classes in the same tab as the main one...I don't need more than one public class, just the main one, the others can be declared just as class className. If others are doing, it must be a way...

P.S: this one is a good example btw:
http://www.newthinktank.com/2013/03/linked-list-in-java-2/

hmm..
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bashkim Ukshini wrote:but there is a way to use other classes in the same tab as the main one

Yes. It means putting all the classes in a single file. At the moment they are all in different files because you put them in different files. If you don't want that, don't use "new class..." or whatever, just keep typing in the same tab.

But as soon as your application becomes anything other than very small, you're going to find that keeping them separate is a good way of organising things.
 
Dave Tolls
Ranch Foreman
Posts: 3067
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bashkim Ukshini wrote:Hey guys, can you please help me find a way to make all my clases in one single tab and not like this:
http://prntscr.com/4ypmzl

because at the end of the exam, we have to paste the whole code (as one) in a specified web page, which instantly shows us the result. We need the whole code to be in just one page (like back in C++).
Can you please help me that, and avoid problems?


Have to say, I never wrote C++ like that.

But as Matthew says, if you have to have everything in a single file then simply write your code in a single file.
The below would be in a file called MyMain.java.

and so on.
 
Kaspersky Ukshini
Ranch Hand
Posts: 122
C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Working perfectly! thank you guys!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!