Thursday, December 8, 2011

A java program!! See why I cant create an object with it,even though it gets compiled!!?

import java.io.*;


public class Project


{


String code,cust_name;


int cust_id,account_no;


double balance;





BufferedReader br=new BufferedReader(new InputStreamReader(System.in));





public void run()throws IOException


{


do{


System.out.println(" Enter Code");


code=br.readLine();


if (code=="5555")


{


getdata();


int ch;


char a='Y';


do{


System.out.println(" Please Select What You Want To Do");


System.out.println(" Select A Choice");


System.out.println(" 1.Withdrawal");


System.out.println(" 2.Deposit");


System.out.println(" 3.Balance Enquiry");


System.out.println(" 4.Exit");


System.out.println(" Enter Your Choice");


ch=br.read();


switch(ch)


{


case 1:


withdraw();


break;


case 2:


deposit();


break;


case 3:


showdata();|||If you mean that you can't run it, then that's because you didn't define a public static method returning void called main (public static void main(String[] arg)).





Try adding this method:





public static void main(String[] arg)throws IOException


{


Project p = new Project();


p.run();


}

No comments:

Post a Comment