-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Java question
PostPosted: Tue Mar 03, 2009 2:19 am 
Newbie

Joined: Tue Mar 03, 2009 2:15 am
Posts: 2
Consider the following code , what is the output provided a valid file name is given on the command prompt?

import java.io.*;
class Q032{

public static void main(String args[]) throws Exception{
FileInputStream fin;
int c = 0;
try
{
fin = new FileInputStream(args[0]);
while ((c = fin.read()) != -1)
{
System.out.print((char)c);
}
}
catch (Exception e)
{
System.out.println(e);
}
fin.close();
}
};

_________________
Corporate clothing
Tee Shirt printing


Last edited by alyssa on Wed Mar 04, 2009 8:13 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 03, 2009 3:03 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
I guess your code will not compile, as fin may not have been initialized...

Whats that, a SCJP exam? Do I get credits for the right answer? ;-)

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 25, 2009 6:41 am 
Newbie

Joined: Wed Mar 25, 2009 6:38 am
Posts: 1
mmerder wrote:
I guess your code will not compile, as fin may not have been initialized...

Whats that, a SCJP exam? Do I get credits for the right answer? ;-)



Hi


I have same question and How many credits you want for the this question



Thanks!

_________________
Website Design
Web Design
visa India


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.