What is blank final variable?

0 votes
I know about final variable. But, I came across blank final variable as well. Can you help me understand that ?
Nov 29, 2018 in Java by Neha
• 6,280 points
113 views

1 answer to this question.

0 votes

A final variable in Java can be assigned a value only once, we can assign a value either in a declaration or later.

    final int i = 10;
    i = 30; // Error because i is final.

blank final variable in Java is a final variable that is not initialized during declaration. Below is a simple example of blank final.

    // A simple blank final example 
    final int i;
    i = 30;

How are values assigned to blank final members of objects?
Values must be assigned in constructor.

answered Nov 29, 2018 by Frankie
• 9,810 points

Related Questions In Java

0 votes
1 answer

What is casting variable in java?

Casting is, taking an Object of one ...READ MORE

answered Jul 17, 2018 in Java by scarlett
• 1,280 points
55 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,190 points
561 views
0 votes
2 answers

What is the syntax to initialize an array?

Rather than learning un-Official websites learn from ...READ MORE

answered Aug 2, 2018 in Java by samarth295
• 2,190 points
59 views
0 votes
2 answers

What is the difference between implements and extends?

Extends : This is used to get attributes ...READ MORE

answered Aug 3, 2018 in Java by samarth295
• 2,190 points
612 views
0 votes
2 answers

What is the use of final class in java?

In Java, items with the final modifier cannot be ...READ MORE

answered Oct 5, 2018 in Java by Daisy
• 8,050 points
54 views
0 votes
1 answer

Interface variable are static and final by default. Why?

Interface variables are static because Java interfaces ...READ MORE

answered Jul 4, 2018 in Java by Daisy
• 8,050 points
1,977 views
0 votes
1 answer

Why Java String class is declared as final?

String class is made final in Java ...READ MORE

answered Aug 21, 2018 in Java by code.reaper12
• 3,450 points
74 views
0 votes
1 answer
+1 vote
1 answer

What is a simple way to repeat a string in java?

From Java 11 on, there's a method String::repeat that does ...READ MORE

answered Aug 28, 2018 in Java by Frankie
• 9,810 points
750 views
0 votes
1 answer

What is Enum in Java?

 It means that the type argument for ...READ MORE

answered Nov 13, 2018 in Java by Frankie
• 9,810 points
67 views