• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using a custom class

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i created a custom class/object that i would like to use in another program.

object - artist.java

program - music.java

in other words, music.java uses the object that i have defined in artist.java. include statements dont seem to work, so how do i get music.java to recognize and use the class in artist.java?
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Erik Stagg wrote:
in other words, music.java uses the object that i have defined in artist.java. include statements dont seem to work, so how do i get music.java to recognize and use the class in artist.java?



Java automatically does this -- meaning look for other classes. As long as your class path is setup correctly (and if you are using packages, the files in the correct directories), you should be good to go.

Henry
 
Erik Stagg
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it was working the whole time apparently! thanks anyway lol
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic