Java Programing laungage

Core Java Tutorial

Introduction of Core Java

How To Install JDk and Set of Path

Syntax of java Program

Difference between Java and C/C++

Advantage and Disadvantage of Java

What is Java

Why Java is not Pure Object Oriented Language

Java has Following Features/Characteristics

Limitation of Java Language and Java Internet

Common Misconception about Java

Simple Program of Java

Integrated Development Environment in java

Compile and Run Java Program

Applet and Comments in Java

Tokens in Java

Keywords in Java

Identifier and Variables in Java


Data Type in Java

Assignments and Initialization in Java

Operators in Java

Rule of Precedence in Java

Operator on Integer and Separators in Java Programming

Java Control Flow of Statements

If and If-else Selection Statement

Nested If-else and If-else-If Selection Statement

switch case and conditional operator Selection Statement

for and while Loop

do..while and for each Loop

break and labeled break statement

continue and labeled continue statement

return Statement and exit() Method

Escape Sequence for Special Characters and Unicode Code

Constants and Block or Scope

Statement in Java

Conversions between Numeric Types in Java

Import Statement in Java

User Input in Java using Scanner Class

User Input in Java using Console Class

Array in Java

One Dimensional Array

Two Dimensional Array

Two Dimensional Array Program

Command Line Argument in Java

String args Types in Java

Uneven/Jagged array in java

Math Class Function and Constant

Math Class all Function used in a program

Enumerated Types in Java

Object Oriented Programming v/s Procedural Programming

Object Oriented Programming Concepts in Java

Introduction to Class,Object and Method in Java

Class Declaration in Java

Class & Objects in java

Encapsulation in Java

Modifiers/Visibility for a Class or Interrface or member of a Class

Polymorphism in Java

Runtime polymorphism (dynamic binding or method overriding)

Import Statement in Java
Previous Home Next

Import is a keyword . Import keyword is used built in or user defined packages into java source code file. When use package in our source file then access the package class with import keyword declaration. The compiler can access any class in the java.lang package without needing an import statement.

import mypackage.*;

import mypackage.extrapackage.*;

import java.applet.*;

Indicate that classes can be found in the mypackage and mypackage.extrapackage packages and also that the Applet class can be found in the java.applet package.

The first import statement gives the full package path name for the Applet class in the packages included with the standard JVM, then when the compiler sees just Applet in the class definition title, it will know where to find it. In the next two import statements, we see the "*" wildcard character used for the classes in the mypackage and mypackage. extrapackage packages. This indicates that these packages hold multiple classes and the compiler should look here if it cannot find a class in the core packages.

Example :

import java.util.Scanner;

public class ScannerTest 
	public static void main(String arg[])
		// scanner gets its input from the console.
		Scanner sc = new Scanner(;
		String name = "";
		System.out.print("Your name "); // Get the user's name.
		name =;
		 // Print their name in a a message.
		System.out.println("Welcome, " + name + " to Javaland!");

In this program uses Scanner class Method is use This class is pre defined class is define java itself and this class method uses in our class , to use import keyword and acess the class.

java is a package and util is a sub package and this package inside the class Scanner.

import java.util.*;

The * is a "regular expression operator" that will match any combination of characters. Therefore, this import statement will import everything in java.util.

If we need multiple classes from different packages, we use an import statement for each package from which we need to import classes (or interfaces, or any other part of that package we need.)

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
Previous Home Next