Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

include class in other file?

 
Chris Weathers
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In c++ we would #include "somefile.h" to get the classes in somefile.h included in the current program.

What is the Java equivalent? I couldn't find the answer in a tutorial I have been working through.
[ May 06, 2005: Message edited by: Chris Weathers ]
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import
 
Chris Weathers
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doh! Thanks... so import "somefile.java"?
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No,

import SomeClass;
 
Chris Weathers
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does SomeClass have to be compiled first?
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...although if it isn't, the java compiler will compile it for you. (Provided it can find the .java file in the right place; this is one of the driving reasons that packages and directory structures must match....)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic