Core Java - Interview Questions and Answers for 'Pre compilation' | Search Interview Question - javasearch.buggybread.com
Questions
Search
List By Company
List By Topic
Legacy
Tests
Repository
DashBoard
Java
Java 8
Java 7
Java Abbreviations
OCJP / SCJP
Class List
New in Java 8
Java Exceptions
Spring Exceptions
Java Enums
Java 8 Lambda
Java 8 java.time
Big Data
Best Of Java
Discussion
Search
Subscribe
Search Interview Questions
More than 3000 questions in repository.
There are more than 900 unanswered questions.
Click here
and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company
Label / Company / Text
Search
Submit Question
Core Java - Interview Questions and Answers for 'Pre compilation' - 1 question(s) found
- Order By Newest
Q1.
What will the following code print and Why
class Class1 {
static{
System.out.println("Wow");
}
public static final int xyz=1;
}
class Class2{
public static void main(String[] args) {
System.out.println(String.valueOf(Class1.xyz));
}
}
Core Java
Ans. 1
Reason being that Class1.xyz is replaced with 1 during pre compilation only and a reference to Class1 is never made.
Help us improve. Please let us know the company, where you were asked this question
:
Like
Discuss
Correct / Improve
 static final   pre compilation
Correction
Duplicate of Another Question
Company where this question was Asked
Suggestion
Related Questions
Will the static block be executed in the following code ? Why ?
Interface can only have ...
What is the following code doing ?
private static final String[] COLORS = new String[] { "Red", "Green", "Blue" };
What are the conventions regarding constant variables or static final variables ?
Why is a constant defined as a static final in Java?
Can you assign value to a static final type at runtime ?
What is the advantage of using static final or constant variables in Java ?
What are the trade offs between public constructor and static final method ?
If we have to maintain a value "7" denoting "number of days in a week" as constant variable, Which of the following is the best constant name and Why ?
SEVEN
NUMBER_OF_DAYS_IN_WEEK
NUMBER_OF_DAYS_IN_WEEK_7
If we have to maintain a value "31" denoting "number of days in a month" as constant variable, Which of the following is the best constant name and Why ?
THIRTY_ONE
NUMBER_OF_DAYS_IN_MONTH
NUMBER_OF_DAYS_IN_MONTH_31
Help us and Others Improve. Please let us know the questions asked in any of your previous interview.
Any input from you will be highly appreciated and It will unlock the application for 10 more requests.
Company Name:
Questions Asked: