Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Compilation error
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


amirZahari
Java Compilation error
0 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners


import java.io.*;
import java.util.*;
import javax.swing.*;

public class saveAccount
{

private String accNo;
private int ind ;
private String name;
private String nm[] = new String [10];
private String acc[] = new String[10];

public saveAccount()
{
accNo="";
ind=0;
name="unknown";
for(int i=0 ; i<10 ; i++)
{
nm[i]="";
acc[i]="";
}
}

public void checkAcc(String no)
{
accNo = no ;
}

public String resultAcc()throws IOException
{
int i,j;
File infile = new File("akaun.txt");
FileReader fileReader = new FileReader(infile);
BufferedReader bufReader = new BufferedReader(fileReader);



i=0 ;
while(i<10)
{
acc[i]=bufReader.readLine();
i++;
}

j=0 ;
while(j<10)
{
if(acc[j]!=null)
System.out.println(acc[j]);

if(acc[j]==null)
System.out.println("unknown");
j++;
}

nm[0]="muhamad amir bin zahari";
nm[1]="wan ainun azlin binti wan khalid";
nm[2]="afwan bin muhamad amir";
nm[3]="nurain binti muhamad amir";

i=0;
while(i<4)
{
if(accNo==acc[i])
{
name = nm[i];
System.out.println(name);
ind = i;
}
i++;
}

return name;
}


public int getInd()
{
return ind;
}

}

i use file in my programe,..
my question is,when i want to call resultAcc() in main,how should i do?

example;

public,...
{
public...
{ ...
saveAccount check = new saveAccount();
owner = check.resulAcc()...?//what should i write here?
}
}

when i write [owner = check.resulAcc()throws IOException;]

get error there,..
[';' expected]
the semicolon i already put at the end like above,..but still the same error..

can u help me solve this problm?please..

my email starshine_undercover@yahoo.com

Advertisement
View Answers

Related Tutorials/Questions & Answers:
java compilation error - Applet
java compilation error  I am getting compilation error in the following code.: public void paint(Graphics g) { switch(screen...; } } Error is: Illegal start of expression Plz. find why am I getting this error
Java compilation error - Java Beginners
Java compilation error  Method overridden problems in compile time error
Advertisements
java compilation error - Applet
java compilation error  hi friends the following is the awt front design program error, give me the replay E:\ramesh>javac...://www.roseindia.net/java/example/java/awt/ Thanks
java compilation error - Hibernate
java compilation error  hi i am getting org.hibernate.exception.GenericJDBCException: Cannot open connection exception when runnig the code why this exception is coming
compilation error - Java Beginners
compilation error  class s { public static... this program it is giving an error as integer number is too large.why? and what is the reason?  Hi Friend, In Java there are some specific literal
Java Compilation error - SQL
Java Compilation error  ava.lang.NullPointerException at beanUtils.SaleHeaderUtility.getFullRemainPatientList(SaleHeaderUtility.java:754) at forms.ProcessDialog.updatePatientBalances(ProcessDialog.java:119
compilation error - Java Beginners
compilation error  sir what is the error inthis code after... : C:\>javac -d . Group.java 3)For execute the programm : C:\>java... not executing the java file currectly, 1- put the Employee.java file in c
java compilation error - Hibernate
java compilation error  hi, i have made an registration page whosevalues should be inserted into database. i have used hibernate and eclipse it is working fine. but when i make a war file and deploy it using ant and then run
java compilation error - Ant
java compilation error  hi, i have a application in which i m reading from an xml file and then storing its values in database.but when i started using ant its main program is not running as it is unable to detect the jar file
compilation error - Java Beginners
compilation error   import java.awt.*; import java.awt.event.*; import javax.swing.*; class BLayout implements ActionListener { JFrame f ; JPanel jp; JButton b[]; CardLayout cl; BLayout(String s) { jp = new JPanel
compilation error - Java Beginners
compilation error  i 'm not able to compile a program : prblem is there is one package in which 2 class person & dog reside. both classes r public... in same package Dog class is being compiled bt. Person is not compiled . error
java compilation error - JDBC
java compilation error   /* *Project:employee.java *Date:April 04,2007. *Purpose:To All Java Developers **/ package employee; import javax.swing.*; import java.awt.*; import javax.swing.border.
compilation error - Java Beginners
compilation error  Dear sir, When i compile some pgms i am getting below error.what may be the reason? "uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details."  Hi Friend
Java Compilation error - Java Beginners
Java Compilation error  I got this error while convert java to pdf... Exception:java.lang.IndexOutOfBoundsException: reserve - incorrect column/size can somebody told me how to handle this error...  Hi Friend
java compilation error - Java Beginners
java compilation error  HELLO SIR,I HAVE ASKED QUESTION AND I GOT REPLY FOR THAT ALSO BUT I AM GETING COMPILATION ERROR UNCHECKED OR UNSAFE OPERATION PLZ RECTIFY THIS. HOW TO READ ELEMENTS FROM TWO ARRAYLIST AND PRINT
java compilation error - Java Beginners
java compilation error  Sir Thanx for ur response for reading a doc file but when i tried to execute ur code compilation error occurs, it says --> org.apache.poi.hwpf package does not exist. -->
java compilation error - Java Beginners
java compilation error  i have downloaded java software(version 6... command, error message is displayed javac is not recognized as an internal... from where i should download java or what to do now?  Have you set
Java Compilation error - Java Beginners
Java Compilation error   i wrote a simple hello world program i get this error every time please help Exception in thread "main" java.lang.NullPointerException
java compilation error - Java Beginners
java compilation error  I need to know how to correct a compiler error for my program to run. The error I keep getting is unclosed string literal... and this is when my compiler error occurs. Let me know if you need any
java compilation error - Java Beginners
java compilation error  Dear Sir ........ I was installed the java... getting the error like file not found : exxx.java(my file name is exx), Ill... Shireesha.  Hi Friend, As you have mentioned that your java file
java compilation error - Java Beginners
java compilation error  i am going to type program and the error is shaded one this one is giving error please sole this one sir import java.io....:"+ch); } }   Hi friend, Having some error in your code check
java compilation error - Java Beginners
java compilation error  Hello, I'm having problems with trying.... It's flagging two errors for this one code. The first error says identifier expected and the next error says invalid method declaration; return type required
java compilation error - Java Beginners
java compilation error  i am going to type program and the error is shaded one this one is giving error please sole this one sir import java.io....:"+ch); } }   Hi friend, Having some error in your code check
Java compilation error - Java Beginners
Java compilation error  Hello I am having this problem while compiling I create a file the package is com.deitel.ch14; the filename...\AccountRecord.java I save AccountRecord.java in ch14 However I get an error saying
Compilation error in java - Java Beginners
Compilation error in java  i have a properties file named... that file in java class,my code is Properties props = new Properties(); File... FileInputStream(f); props.load(in); but i got a error the system could
Java compilation error - Java Beginners
Java compilation error  Hello, i am getting an error while running simple core java program on command prompt.java is installed on my pc. the error is: javac:file not found usage:javac Regards, jyoti prakash 
java compilation error - Java Beginners
java compilation error  Hello madam/sir, i m a beginners in java. My problem is that i want to connect a login form to a frame containing 4 panels. how could i do it?Please help
java compilation error - Java Beginners
java compilation error   1)java code: import java.awt.*; import...(multBut); } } ****** its code is being compiled . But the command java ButtonPanelApplet does give me error of "exception in thread main...."  
Java Compilation Error - Java Beginners
Java Compilation Error   Actually Iam having a packaging. Whatever... imported packages. What ever error iam getting is at the array usage. So, guide me...; weight=w; } For any more information on Java visit to : http
Java compilation error - Java Beginners
Java compilation error  hai, now only i have started to work with java.I have been given a task as execute unix codes using eclipse.But i dont know the source codes.Please help me to start the program... Regards, R.Punitham
java compilation error - Java Beginners
java compilation error  can not find symbol sysbol:method println(int,int,int) location: class java.io.PrintStream) System.out.println(+a,+b,+c);  Hi friend, Please, specify in detail what's your problem
Advertisements
 

 

 

DMCA.com