About Question enthuware.ocajp.i.v7.2.1242 :
Moderator: admin
About Question enthuware.ocajp.i.v7.2.1242 :
I don't see the args[2] reference in the code.
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
Code: Select all
int i = Integer.parseInt(args[1]);
System.out.println(args[i]);
so i is 2
therefore, args is args[2]
HTH,
Paul.
-
- Posts: 10
- Joined: Tue Feb 12, 2013 9:12 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
Yeah, this one got me also
-
- Posts: 15
- Joined: Thu Dec 13, 2012 9:44 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
I have a basic question,
why is the method name just parseInt() instead of parseInteger()?
Please reply,
why is the method name just parseInt() instead of parseInteger()?
Please reply,
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
You have to ask Java designers that 

-
- Posts: 1
- Joined: Mon Mar 30, 2015 3:00 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
If I run the code with 4 and 5 I also get the exception, in this case shouldn't args[0] = 4 and args[1]=5?
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
Yes, args[0] = 4 and args[1]=5. But I am not really sure what is your point.peckw1 wrote:If I run the code with 4 and 5 I also get the exception, in this case shouldn't args[0] = 4 and args[1]=5?
Paul.
-
- Posts: 2
- Joined: Wed Jul 08, 2020 8:12 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1242 :
System.out.println(i);//2
System.out.println(args); //i=2, so, args[2] --> throw an exception
Yes, this one got me also....
System.out.println(args); //i=2, so, args[2] --> throw an exception
Yes, this one got me also....

Who is online
Users browsing this forum: Bing [Bot] and 4 guests