Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overriding methods

 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
could someone explain me why this code works?
Compiler gives me warning 'go(int[]) in B cannot override go(int...) in A'
but .... it compiles and prints: 12

 
Vidya Singh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not give any warning to me while compiling.
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Hibernate Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
compiles fine and output 12
 
Kishore Kumar
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also getting the warning message during compiling and the output is also 12.
I am using java 1.5 version.

Main.java:7: warning: go(int[]) in
method is missing '...'
public int go(int [] d){
^
1 warning


Can any one tell me why i am getting this warning message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic