Which of these keywords can be used to prevent inheritance of a class ?
Anonymous Quiz
46%
final
11%
constant
30%
super
5%
stop
8%
class
π3π1
π9π1
π3π₯°1
previous quiz has been deleted, as wrong option was marked as correct.
Correct answer was Equal
Correct answer was Equal
What is the purpose of a default constructor in Java?
Anonymous Quiz
35%
To provide a default value for an object
40%
To initialize instance variables with default values
20%
To call another constructor within the same class
5%
None of the above
π3
what are static blocks and static initalizers in Java ?
answer : Static blocks or static initializers are used to initalize static fields in java. we declare static blocks when we
want to intialize static fields in our class. Static blocks gets executed exactly once when the class is loaded
. Static blocks are executed even before the constructors are executed.
answer : Static blocks or static initializers are used to initalize static fields in java. we declare static blocks when we
want to intialize static fields in our class. Static blocks gets executed exactly once when the class is loaded
. Static blocks are executed even before the constructors are executed.
π8
How to call one constructor from the other constructor ?
answer : With in the same class if we want to call one constructor from other we use this() method. Based on the
number of parameters we pass appropriate this() method is called.
Restrictions for using this method :
1) this must be the first statement in the constructor
2)we cannot use two this() methods in the constructor
answer : With in the same class if we want to call one constructor from other we use this() method. Based on the
number of parameters we pass appropriate this() method is called.
Restrictions for using this method :
1) this must be the first statement in the constructor
2)we cannot use two this() methods in the constructor
β€4π1
which access modifier is the most strict(provides least visibility) in java
Anonymous Quiz
21%
public
51%
private
8%
default
20%
protected
π4
we try to bring lot of content, with great effort. Please subscribe to our youtube channel as token of appreciation of our work. Below is the link to our youtube channel.
https://www.youtube.com/c/frbjava
https://www.youtube.com/c/frbjava
π1
Anonymous Quiz
64%
Sequentialβββ
15%
Random
18%
Sequential and Randomββ
4%
None of the above
π3π₯2
Anonymous Quiz
33%
boolean a = 1;
12%
boolean _b = βfalseβ;
47%
boolean c = false;
8%
boolean d = βtrue:
π4π1
π₯4
Why a constructor cannot be final in Java?
Ans: If a method is marked as final it means we do not want any class to override it. As per Java Language Specification, a constructor cannot be overridden. So, there is no use in declaring a constructor as final.
Ans: If a method is marked as final it means we do not want any class to override it. As per Java Language Specification, a constructor cannot be overridden. So, there is no use in declaring a constructor as final.
π6
for more susch interview questions please follow our linkedin page
https://www.linkedin.com/feed/update/urn:li:share:7028945918791925760/
https://www.linkedin.com/feed/update/urn:li:share:7028945918791925760/
Linkedin
FRB Java on LinkedIn: #java
Why a constructor cannot be final in Java?
#java Ans: If a method is marked as final it means we do not want any class to override it. As per Java Languageβ¦
#java Ans: If a method is marked as final it means we do not want any class to override it. As per Java Languageβ¦
π1
π2
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://tinyurl.com/dzrt4f7d
Discuss doubts in @tcs_infosys_accenture
https://tinyurl.com/dzrt4f7d
Discuss doubts in @tcs_infosys_accenture
π1
Anonymous Quiz
7%
C++
15%
J++
74%
OAK
4%
TEAK
π3
π9β€1π1π1