Some tips to solve your java technical test paper

Posted by

I found some tricks to solve java questions, when you are appearing for any kind of technical written test.I think it might help you too.Follow these tricks to get your test paper solved in less time.

  1. If you are asked to find value of a number after shifting right.Then just divide that number by 2 and discards the remainder.The qotient will be the answer.
                                For ex. 32>>2
         divide 32 by 2 two times because it is shifting two times.The ans will be 8.
    2. Java keywords are always lowercase, you can immeadiately any capitalized word appearing in a
        question listing the possible keywords.
    3.Class declared with both final and abstract will give compile-error.
    4. Interface method declared with static will give compile-error.

5. Variables can have the same name as methods or class.

6. A constructor body can include a return statement providing no value is returned.    7. main can be declared as final.

8. You can not cast a boolean type to another primitive data type.

9. Java compiler will compile the classes that do not have contain a main() method but java interepreter
has no way to run those classes.

10. You do not have to have a default statement in a switch() block.

11. The default statement in switch() block can be appeared anywhere,does not have to be last.

12. All section of for loop are optional.

13. finalize() can execute only once on any object.

14. If any operand double in an expression then result is double.

15. If any operand is long in an expression then result will be promoted to long.

16. All bytes and shorts are promoted to int in an expression.

17. Conversion int to byte: syntax will be (byte)int var and the result will be remainder of any integer
divison by byte’s range i.e. 256

18. It is intersting to note that if you shift -1 right ,the result always remains -1.


One comment

Leave a Reply