49 Program to perform demonstrate final method in Java.

Code:

// Final Method

import java.io.*;
import java.util.*;
class FinalMDemo
{
static int a = 10 , b = 20;

// static final void display()

final static void display()
{
Scanner scan = new Scanner( new InputStreamReader( System.in ) );

System.out.println("A: "+a);

b  = scan.nextInt();
System.out.println("B: "+b);
}

public static void main( String args[] )
{
display();
}
}


Output:





Previous
Next Post »