Welcome Guest | Sign in | Register
Final and Datatypes - Discussion Page For Q.2732 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Final and Datatypes > Questions and Answers

Q: Public class Manager{
Static final String name=”init”;
Static{
name=”lara”;
}
Public static void main(String args[]){
System.out.println(name.length()); } }
A. 0 B. null
C. compile time error D. 4

Answer and Explanation

Answer:4

Explanation:
Final variable value is fixed. Here while declare a variable they have initialized , and inside a static variable also they have initialized. Therefore two times they can’t initialize a same final variable if so it will throw an compile time error.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved 2012-2015 SoftLucent.