Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confusion with output...

 
Ganeshkumar cheekati
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

output is:int,int...

why it is choosing method1 eventhough it is having two parameters?

if i uncomment method2 it select that and giving output as int.

can you tell me the reason?
 
ramesh maredu
Ranch Hand
Posts: 210
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ganesh,

I was also not sure about it so i decompiled it with jad it generated below code with doSomething(int i) commented


if you uncomment it generates the below code.

 
subhasish nag
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is because var args expect from 0 to many ints parameter.
[ November 02, 2008: Message edited by: subhasish nag ]
 
Ganeshkumar cheekati
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ramesh.
transient keyword is used for only instance variables.

check in your code..
 
Ganeshkumar cheekati
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes you are right subhasish.
 
ramesh maredu
Ranch Hand
Posts: 210
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
transient keyword is used for only instance variables.


Yes, you are correct, I don't think decompilers can generate exact code but we can get some idea from the generated code.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic