English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

what does import java.io.* and import java.lang.string mean....y r they used??

2007-12-07 06:23:54 · 7 answers · asked by fara 1 in Computers & Internet Programming & Design

7 answers

Check out the following link ..its the tutorial for java...ull find every thing here:

http://java.sun.com/docs/books/tutorial/java/index.html

i wish all the best

2007-12-07 07:20:33 · answer #1 · answered by Rapa 6 · 0 0

Much the same as #include statements in C and C++; they bring in function libraries that you might need in the program. If you've written a line of code that calls a Java library function and the compiler claims to not recognize it, chances are you didn't import the appropriate library.

2007-12-07 14:29:16 · answer #2 · answered by jgoulden 7 · 0 0

The import directive tells the compiler where to look for the class definitions when it comes upon a class that it cannot find in the default java.lang package. So, for example, in the class definition below for TestABC, the import statements

import mypack.*;
import mypack.extrapack.*;
import java.applet.*;

indicate that classes can be found in the mypack and mypack.extrapack packages and also that the Applet class can be found in the java.applet package.

2007-12-07 14:27:52 · answer #3 · answered by daa 7 · 0 0

When you are speaking with someone on the road and start talkng to him about Joe,Sandra, Eddy , Vicky and Julieet .What are the chances that he knows them all ? What is his response ?Who is Vicky ?Who is Eddy ? etc ..right ?
Similary, when you use the import statement , you tell the compiler about the guys that you are going to use and where they can be referecned. Thus compiler knows what S*** you mean when you refer to someone. Ofcourse it never cares what you going to do with it , just as the guy on the road.
Please excuse my language as tried to explain it in most simple terms using relative examples.

2007-12-09 00:06:35 · answer #4 · answered by Satya 3 · 0 0

To use some keyword in Java we should use import. else that keyword cannot be used in a program.
java.io,java.lang... all r libraries that gives some specific set of keywords or functions.
Importing means, bringing..ie,just bringing that libraries in our program to run that program efficiently....

2007-12-08 02:29:47 · answer #5 · answered by ♫♥♪♥Jeni♫♥♪♥ 3 · 0 0

They make certain class libraries available so that you can call the methods of the class.

2007-12-07 14:28:28 · answer #6 · answered by Tony B 3 · 0 0

1) import java.util.List
//..........part of program
List myList=null
//..........part of program

Hear the import statements tell the compiler to look for the used class i.e.List in the java.util package.

2)you can also write as follows without writing import keyword

//..........part of program
java.uti.List myList=null
//..........part of program

2007-12-08 03:32:22 · answer #7 · answered by rites 3 · 0 0

fedest.com, questions and answers