logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How to define a constant variable in Java?


  • Correct Answer
  • The variable should be declared as static and final So only one copy of the variable exists for all instances of the class and the value can't be changed also static final int PI = 214; is an example for constant 


  • Technology problems


    Search Results


    • 1. Is Java a pure object oriented language?
    • Discuss
    • 2. What is difference between Path and Classpath?
    • Discuss
    • 3. What is the maximum number of Triggers can be applied in a table ?

    • Options
    • A. 8
    • B. 9
    • C. 12
    • D. 14
    • Discuss
    • 4. What is DocumentDB ?
    • Discuss
    • 5. Which of the following are elements of SQL?

    • Options
    • A. base-table-identifier ::= user-defined-name
    • B. base-table-name ::= base-table-identifier
    • C. boolean-primary ::= comparison-predicate
    • D. All the above
    • Discuss
    • 6. What is the access scope of a protected method?
    • Discuss
    • 7. What is the impact of declaring a method as final?
    • Discuss
    • 8. Which of the following is not used for commenting in java?

    • Options
    • A. //
    • B. /* */
    • C. /** */
    • D. /** **/
    • Discuss
    • 9. Which is true?

    • Options
    • A. "X extends Y" is correct if and only if X is a class and Y is an interface
    • B. "X extends Y" is correct if and only if X is a class and Y is an interface
    • C. "X extends Y" is correct if X and Y are either both classes or both interfaces
    • D. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces
    • Discuss
    • 10. class Hell { public static void main(String[] args) { Integer i = 42; String s = (i<40)?"life":(i>50)?"base":"ball"; System.out.println(s); } }

    • Options
    • A. null
    • B. ball
    • C. base
    • D. None
    • Discuss


    Comments

    There are no comments.

Enter a new Comment