09-26-2007, 04:16 PM
class Cat { }
class Dog {
public static void main(String [] args) {
Dog d = new Dog();
System.out.println(d instanceof Cat);
}
}
Why the fuck won't that compile? you can't compare an object to some other object? do some swapping and you see that:
System.out.println(d instanceof Cat); //does not compile
System.out.println(d instanceof Dog); //compiles
if(d instanceof Cat); //also compiles
So, i know this isn't how you'd normally use this..but something funky is going on here. For some reason when it's used as an expression there it fails. WTFZO!?
class Dog {
public static void main(String [] args) {
Dog d = new Dog();
System.out.println(d instanceof Cat);
}
}
Why the fuck won't that compile? you can't compare an object to some other object? do some swapping and you see that:
System.out.println(d instanceof Cat); //does not compile
System.out.println(d instanceof Dog); //compiles
if(d instanceof Cat); //also compiles
So, i know this isn't how you'd normally use this..but something funky is going on here. For some reason when it's used as an expression there it fails. WTFZO!?
2013 Cadillac ATS....¶▅c●▄███████||▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅▅||█~ ::~ :~ :►
2008 Chevy Malibu LT....▄██ ▲ █ █ ██▅▄▃▂
1986 Monte Carlo SS. ...███▲▲ █ █ ███████
1999 F250 SuperDuty...███████████████████►
1971 Monte Carlo SC ...◥☼▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙☼◤
2008 Chevy Malibu LT....▄██ ▲ █ █ ██▅▄▃▂
1986 Monte Carlo SS. ...███▲▲ █ █ ███████
1999 F250 SuperDuty...███████████████████►
1971 Monte Carlo SC ...◥☼▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙☼◤