Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void m1(Integer f) {
- ...
- }
- public void m1(Float f) {
- ...
- }
- public void main() {
- m1(null); // error: the method m1(Integer) is ambiguous for the type Main
- m1((Integer) null); // success
- }
- Integer i = null;
- Object o1 = (Object) i;
- Float f = null;
- Object o2 = (Object) f;
- System.out.println(o1 == o2); // prints true
- // in short:
- System.out.println(((Object) ((Integer) null)) == ((Object) ((Float) null))); // prints true
- class A {
- public static void hello() { System.out.println("Hello World"); }
- public static void main(String... args) {
- A a = null;
- a.hello();
- System.out.println("a is an A is " + (a instanceof A)); // prints false.
- }
- }
- Integer a = null;
- Double b = null;
- m1((Integer) null);
- Integer i = null;
- (Integer)null
Add Comment
Please, Sign In to add comment