• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Package Compilation

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two classes:
File 1:
package MyPackage;
class Balance{
String name;
int bal;
Balance(String n, int b){
name = n;
bal = b;
}
void show(){
if(bal>0)
System.out.println("--> " + name + " " + bal);
}
}
File 2:
package MyPackage;
class AccountBalance{
public static void main(String args[]){
Balance current= new Balance("Me", 0);

}
}
These seperate files both include the package statements, and are both physically located inside the MyPackage directory. The directory structure is:
C:\Exam\MyPackage
I have fooled around with various import statements, tried moving to the above directory, mumbulled incantions to several fire-gods, but I can't get these to compile. What should I do!?!?
 
Ranch Hand
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, fire gods are for run time errors, not compile errors. Secondly, mortals need to know the error message you are getting.
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic