Results 1 to 5 of 5
  1. #1
    Adithya is offline Member
    Join Date
    Jun 2014
    Posts
    24
    Rep Power
    0

    Default how to use the excption handling as a base class

    i want to use my given code as base class
    help me !!
    Java Code:
    public static void file(String[] arg) throws IOException{
    	   
    
    	   BufferedReader in;
    	   String line;
    	   
    	   try{
    		   System.out.println("Reading word");
    		   in =new BufferedReader(new FileReader("inp.txt"));
    		     String[] wor = new String[1000];
    		    String[] mean =new String[1000];
    		    int i=0;
    		   do{
    			   line = in.readLine();
    			   if(line != null)
    			   {
    			     String[] word = line.split(";");
    			         wor[i] = word[0];
    		        	 mean[i] = word[1];
    					 System.out.println(wor[i]);
    					 System.out.println(mean[i]);
    				
    				
    			 //  System.out.println("splited");
    			//  System.out.println(Arrays.toString(word));
    			   }
    		   }while(line != null);
    
     }catch (IOException e) {
    		          e.printStackTrace();
    		   
    	   }
       }
    	   
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,529
    Blog Entries
    7
    Rep Power
    20

    Default Re: how to use the excption handling as a base class

    I don't understand your code: the file( ... ) method declares that it can throw an IOException, but it is catching it ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    449
    Rep Power
    6

    Default Re: how to use the excption handling as a base class

    Since static methods can not be overridden, what is the purpose of making your class as base?

    Please let us know what exactly you want in your next response.
    Mak
    (Living @ Virtual World)

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: how to use the excption handling as a base class

    I can venture a guess that 'base' == 'main'.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    Adithya is offline Member
    Join Date
    Jun 2014
    Posts
    24
    Rep Power
    0

    Default Re: how to use the excption handling as a base class

    i am telling here my total concept....
    I read a file and split the word that stored in two arrays one is question and other is meaning.
    i have generate random one question and with our meaning to print.if the user select correct answer it have to goes for another question.that is It has to call the function one more time..until the user gets out...
    so i used this is a base class..and another one for random generation and another to check.if correct means it returns to the random generation class..
    this is my concept.give me idea to implement.after i implementation i goes for advance with this to create button,panel for provice Graphical user interface
    Last edited by Adithya; 06-17-2014 at 12:19 PM.

Similar Threads

  1. Replies: 1
    Last Post: 06-17-2013, 05:04 PM
  2. Passing instance of derived class as base class
    By goatjugsoup in forum New To Java
    Replies: 7
    Last Post: 08-01-2012, 05:15 AM
  3. Calling base class methods
    By new2java2009 in forum New To Java
    Replies: 1
    Last Post: 11-15-2011, 10:47 PM
  4. Replies: 3
    Last Post: 09-29-2010, 09:26 AM
  5. please check me this excption
    By javanew in forum New To Java
    Replies: 5
    Last Post: 05-18-2010, 08:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •