aspose file tools*
The moose likes Beginning Java and the fly likes What is the output ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the output ?" Watch "What is the output ?" New topic
Author

What is the output ?

Jalli Venkat
Greenhorn

Joined: Aug 10, 2006
Posts: 27
HI Friends,
I wrote a class like as follows.

Class A() {
void add(String a,String b) {
System.out.println("add method with strings");
}

void add(Date d1,Date d2) {
System.out.println("add method with dates");
}

}

If I call above add method with parameter values as "null" like as follows, then what will be the output?

add(null,null);

It will throws any exception or displays any message?

please answer this .


venkat
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

Best way to find out is, try it your self. Then you can experiment in different ways as well.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Jalli also UseCodeTags to make the program more readable



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

Vijitha Kumara wrote:Best way to find out is, try it your self. Then you can experiment in different ways as well.



SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
supriya riya
Ranch Hand

Joined: Feb 23, 2009
Posts: 41
I think while compiling itself it will give message
ambigious
etc,as null value is applicable both for String and Date .how will compiler know which add?both have null as valid parameters.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"supriya java " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Vijitha Kumara wrote:Best way to find out is, try it your self. Then you can experiment in different ways as well.


+1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the output ?