Jump to content
Sign in to follow this  
game-game

Passing Buffer Dalam Method

Recommended Posts

actually,aku nak pass method buffer dalam method lain..camnie maksud aku..

public blabla ......{

try {

FileReader ReadAFile = new FileReader("masterFile.txt");

BufferedReader bacaFile = new BufferedReader(ReadAFile);

}

catch(IOException e) {

}

}

public blabla2.....{

//aku nak gne bacaFile.readLine() kat cni..

}

die kate tak jumpe file..

paham tak korang?? aku tak tau jelas ke tak...

Share this post


Link to post
Share on other sites

cmni kot :

public class One {

 public BufferedReader parse() {
  BufferedReader bacaFile = null;
  try {
   bacaFile = new BufferedReader(new FileReader("xxx.txt"));
   return bacaFile;
  } catch (Exception e) {
    return;
  }
 }

 public void method2() {
  BufferedReader br = parse();
 }
}

pape pun, refer kat javaalmanac :lol:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...