import java.awt.*;
// Need this import for reading data:
import java.io.*;

// reading data in a Java application
public class Power {

    public static void main (String [] args) throws IOException {
	// Create a buffered reader
	BufferedReader in = new BufferedReader(
			new InputStreamReader(System.in));
	// string for storing a line of input
	String line;

	// Read one integer
	// prompt the user:
        System.out.print("Please enter a number: ");
	// read a line of input:
	line = in.readLine();
	// extract a double:
	double n = Double.parseDouble(line);
	// compute the cube of n
	double cube = Math.pow(n, 3);
	System.out.println("The cube of n is " + cube);
    }
}

This is an example from CSci 1211 course.