Answer: primitive type and the right-hand side of an instanceof operator : Questions « Operators « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Operators » Questions 
2.12.12.Answer: primitive type and the right-hand side of an instanceof operator
B

public class MainClass{
    public static void main(String[] argv){
        int i =1;
        
        System.out.println(instanceof i);
    }
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
	i cannot be resolved to a type

	at MainClass.main(MainClass.java:5)
2.12.Questions
2.12.1.May an interface type appear on the left-hand side of an instanceof operator?
2.12.2.Answer: interface type and instanceof operator
2.12.3.May a variable of primitive type appear on the left-hand side of an instanceof operator?
2.12.4.Answer: primitive type and instanceof operator
2.12.5.May a variable of object type appear on the right-hand side of an instanceof operator?
2.12.6.Answer: Reference type and instanceof operator
2.12.7.May a class appear on the right-hand side of an instanceof operator?
2.12.8.Answer: Class and instanceof operator
2.12.9.May an interface appear on the right-hand side of an instanceof operator?
2.12.10.Answer: interface and right side of instanceof operator
2.12.11.May A variable of primitive type appear on the right-hand side of an instanceof operator?
2.12.12.Answer: primitive type and the right-hand side of an instanceof operator
2.12.13.May a name of a primitive type appear on the right-hand side of an instanceof operator?
2.12.14.Answer: name of a primitive type and right-hand side of an instanceof operator
2.12.15.What is -50 >> 1?
2.12.16.Answer: result of -50 >> 1
2.12.17.What will happen when you try to compile the following code?
2.12.18.Answer: instanceof arraytype
2.12.19.How to check if the object reference x has the null value?
2.12.20.Answer: instanceof null
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.