• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

New to Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey everyone!

I'm taking an introductory Java class in school which we are also using Netbeans for the class. I think I'm doing okay except for maybe one or two hiccups. I also wanted to know how would I combine two classes and run them as one application. Well, here we go!





 
Sheriff
Posts: 7113
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James, Welcome to the JavaRanch!

When you're first writing code, you tend to put it all in the main() method. But quickly you run into problems like yours: how do I combine the classes?

The "right" answer is to get the code out of the two main() methods and into their own methods, then call them both from a very simple main() method. You will find in practice that the main() method will be as simple as this:

 
Master Rancher
Posts: 4888
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also posted atL http://www.java-forums.org/new-java/95570-i-cant-figure-out-what-wrong.html (see post#12)
 
James Winfield
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:Also posted atL http://www.java-forums.org/new-java/95570-i-cant-figure-out-what-wrong.html (see post#12)



Is it a bad thing to post in another forum to get more than one set of eyes? If it is let me know and I won't do it again.
 
Knute Snortum
Sheriff
Posts: 7113
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In some forums you're not allowed to cross-post; here we just want you to be upfront about it.

The problem with cross-posting is that someone could work on a solution for you and you already have a solution in the other forum. It wastes people's time.

But if you're upfront about it, and have a link to the other site, a person can check the other site first and see if the issue has been resolved there.
 
James Winfield
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:In some forums you're not allowed to cross-post; here we just want you to be upfront about it.

The problem with cross-posting is that someone could work on a solution for you and you already have a solution in the other forum. It wastes people's time.

But if you're upfront about it, and have a link to the other site, a person can check the other site first and see if the issue has been resolved there.



Okay, thanks for letting me know.
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic