Yes it's possible.
This is how you use scanner:
How can I read input from the console using the Scanner class in Java?
Intro to content in URL above:
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
System.out.println("Enter your username: ");
Scanner scanner = new Scanner(System.in);
String username = scanner.nextLine();
EDIT:
Here's a program that applies the concept above and takes radius from user and draws a circle on a frame:
import java.awt.Frame;
import java.awt.Graphics;
import java.util.Scanner;
 public class Painting extends Frame{
 int num=0;
Painting(){
   super("Paint");
   setSize(300,300);
   setVisible(true);
   Scanner myScanner = new Scanner(System.in);
   System.out.println("Enter Radius");
   num = myScanner.nextInt();
  repaint();
      }
    public void paint(Graphics g){
        g.drawOval(50, 50, (2*num), (2*num));
     }
      public static void main(String[] args)
       {
          new Painting();
         }
        }