Solution is to rename the file or the class name to make them same. If a public class name is ABC then the file name of that class must be ABC.java. So always copy the class name and paste it when naming the file, then we will not face this error anymore.
Sunday, November 30, 2008
Published 11/30/2008 by Shamsuddin Ahammad with 3 comments
Solution is to rename the file or the class name to make them same. If a public class name is ABC then the file name of that class must be ABC.java. So always copy the class name and paste it when naming the file, then we will not face this error anymore.
Subscribe to:
Post Comments (Atom)
not necessarily. remember, you can have several classes in one file.
ReplyDeleteto complete your previous post:
the name of the file must be identical to the name of the public class name. it is very well possible to have a
Loader.java file without a Loader - class in it, even though it can contain several other classes.
Really appreciated the information and please keep sharing, I would like to share some information regarding online training.Maxmunus Solutions is providing the best quality of this JBOSS Technology And this online training will be very convenient for the learner.And the training will be online and very convenient for the learner.
ReplyDeleteFor Joining online training batches please feel free to call or email us.
Email : minati@maxmunus.com
Contact No.-+91-9066638196/91-9738075708
website:-http://www.maxmunus.com/page/JBoss-Administration-Training
import java.util.Scanner;
ReplyDeletepublic class Resturentmenu {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int choice;
double total = 0;
double tax;
double vat;
double totalBill;
System.out.println("Welcome");
System.out.println("Here are the munu that we have.");
System.out.println("-------------------");
String[] menuItemNames = new String[10];
String[] menuItemDescriptions = new String[10];
double[] menuItemPrices = new double[10];
menuItemNames[0] = "0. Roti";
menuItemDescriptions[0] = "= Rs:";
menuItemPrices[0] = 12.99;
menuItemNames[1] = "1. MO:MO";
menuItemDescriptions[1] = "= Rs:";
menuItemPrices[1] = 100.99;
menuItemNames[2] = "2. Chomin";
menuItemDescriptions[2] = "= Rs:";
menuItemPrices[2] = 40.69;
menuItemNames[3] = "3. Home Salad";
menuItemDescriptions[3] = "= Rs:";
menuItemPrices[3] = 60.98;
menuItemNames[4] = "4. Soft Drink";
menuItemDescriptions[4] = "= Rs:";
menuItemPrices[4] = 40;
menuItemNames[5] = "5. Hard Drink";
menuItemDescriptions[5] = "= Rs:";
menuItemPrices[5] = 500.98;
menuItemNames[6] = "6. Caffee";
menuItemDescriptions[6] = "= Rs:";
menuItemPrices[6] = 60.98;
menuItemNames[7] = "7. Drum Stick";
menuItemDescriptions[7] = "= Rs:";
menuItemPrices[7] = 100;
menuItemNames[8] = "8. Sacess";
menuItemDescriptions[8] = "= Rs:";
menuItemPrices[8] = 60;
menuItemNames[9] = "9. Tea";
menuItemDescriptions[9] = "= Rs:";
menuItemPrices[9] = 35.00;
// Print out menu:
for (int i = 0; i < menuItemNames.length; i++) {
System.out.println(menuItemNames[i] + " "
+ menuItemDescriptions[i] + " "
+ menuItemPrices[i]);
}
System.out.println("-------------------");
System.out.println("Please Enter a Menu Selections");
for (int i = 0; i < menuItemNames.length; i++) {
choice = sc.nextInt();
total = menuItemPrices[choice];
tax = 0.10 * total;
vat = 0.13 * total;
totalBill = total + vat;
System.out.println("Your Item prices RS=" + total);
System.out.println("============================");
System.out.println("Your total tax RS=" + tax);
System.out.println("============================");
System.out.println("Your total vat RS=" + vat);
System.out.println("============================");
System.out.println("Total cost RS=" + totalBill);
System.out.println("============================");
if (i == 4) {
break;
}
}
}
String Resturentmenu;
}
public class Resturentmenu {
public static void main(String[] args){
Resturentmenu method = new Resturentmenu();
System.out.println("Do you want to order again"+method.Resturentmenu);
}
}