Final keyword example

class FinalvarDemo {
	final int x;
	public FinalvarDemo(int x) {
		this.x = x;
	}
}
public class FinalDemo1 {
	public static void main(String[] args) {
		FinalvarDemo v1 = new FinalvarDemo(10);
		FinalvarDemo v2 = new FinalvarDemo(20);
		FinalvarDemo v3 = new FinalvarDemo(30);
		System.out.println(v1.x);
		System.out.println(v2.x);
		System.out.println(v3.x);
	}
}

Download

Access modifiers in Java

Complete abstract Example
Complete final Example
Static Block
Static variable
Static method


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code