Importing Static members of a class

The static import construct allows unqualified access to static members without inheriting from the type containing the static members.

Use import static keyword
import static packagename.classname.*;
Example:-
import static java.lang.System.*;
Solution 2:-
package com.java;
import java.util.Scanner;
import static java.lang.System.*;
import static java.lang.Math.*;
class Power1
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(in);
		out.print("Enter the No : ");
		double num=sc.nextDouble();
		
		out.print("Enter the Power : ");
		double p=sc.nextDouble();

		double result=pow(num,p);
		out.printf("%.2f to the power %.2f is %.2f",num,p,result);		
	}
}
		
		
Output:
Enter the No : 2
Enter the Power : 2
2.00 to the power 2.00 is 4.00

ScanConsoleApp

It demonstrates how to read int, float, and double values from the keyboard.
package com.java;
import java.io.*;
import java.util.*;
/** Demonstrate the Scanner class for input of numbers.**/
public class ScanConsoleApp
{
  public static void main (String arg[]) {
    // Create a scanner to read from keyboard
    Scanner scanner = new Scanner (System.in);

      System.out.printf ("Input int (e.g. %5d): ",3501);
      int int_val = scanner.nextInt ();
      System.out.println (" You entered " + int_val +"\n");

      System.out.printf ("Input float (e.g. %5.2f): ", 2.43);
      float float_val = scanner.nextFloat ();
      System.out.println (" You entered " + float_val +"\n");

      System.out.printf ("Input double (e.g. %6.3e): ",4.943e15);
      double double_val = scanner.nextDouble ();
      System.out.println (" You entered " + double_val +"\n");

    }
  
} 
Output:
Input int (e.g. 3501): 23111
You entered 23111
Input float (e.g. 2.43): 324.45000
You entered 324.45
Input double (e.g. 4.943e+15): -34.e4
You entered -340000.0