Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. What is package?
Ans:
Package is a collection of group of similar types of classes, interfaces and sub
packages.
Ans:
i) Package use to search .class file very faster.
ii) It is use to categorize classes & interfaces so that they can be easily
maintained.
iii) Package use to remove naming collision.
3. What are the diff. types of package with example& define them?
Ans:
Package categorized into 2 types
i) Built-in package
ii) User-defined package.
Built-in package-If the package already design & stored in the predefined class
then it is known as Built –in package.
Ans:
Package is a keyword in java which is used to designed user defined package.
Ans:
Lang is the default package in java.
Ans:
Class path able to set by 2 different ways:
i) Permanently within environment variables
ii) Temporarily by set class path command.
Ans:
Javac -d . filename.java
8. How to create a .jar file?
Ans:
jar -cvf Filename.jar Filename.class
Ans:
jar -cmf manifest_fileFilename.jar Filename.class
10. How to use the class file, i.e. ways to access the class file. And diff b/w import
and fully qualified name?
Ans:
Two different ways user can use the class file.
i) by import keyword
ii) by fully qualified name.
In case of package importing no need to specify the full path of package. But in
case of fully qualified name user has to specify the package name each time to
access the class and it is not flexible.
Ans:
Fully qualified name is requiredwhen same class present in more than one
package.
Ans:
No not required
Ans:
There are 3 ways to access the package from another package
i) import package.*;
ii) import package . class name.
iii) fully qualified name.
Ans:
Package inside the package is called the sub package.It is use to categorise the
package further.
Ans:
Lang package.
16. Does Importing a package imports its sub-packages as well in Java?
Ans:
No importing package means only current package not its sub-package.
Ans:
i) package provides access protection.
ii) package removes naming collision.
Ans:
The import keyword used to make the classes and interfaces of another package
accessible to the current package.
Ans:
80,000 classes present in 202 no of packages.
Ans:
Lang is the default package in java.
Ans:
The package keyword is used to create a package.
Ans:
We need to use fully qualified name every time when accessing the classes and
interfaces.
23. State the operation & package of Socket& Server Socket classes?
Ans:
Socket & Server socket class present in net package and its operation mainly for
networking purpose.
Ans:
Input/Output classes present in io package.
Ans:
There are 2 ways to load class file
Temporary:
i) by setting the class path in the command prompt.
ii) by class path switch.
Permanent:
Ans:
Document API can create in java by the help of javadoc tool.
Ans:
java.lang.* is used for language functionalities.
Ans:
java.io.* is used for file handling application.
Ans:
java.awt.* is used for GUI components.
Ans:
java.applet.* is used for browser oriented application.
Ans:
java.net.* is used for client server application.
32. Which package is used for developing quality or reliable application in java?
Ans:
java.util.* is used for quality or reliable application in java.
33. Which package is used for formatting data and time on day to day business
operation?
Ans:
java.text.* is used for formatting data and time on day to day business
operation.
Ans:
This package is used for providing the functionality of GUI components.
Ans:
java.util.* is also known as collection framework in java.
36. Which package is used for runtime information about the class and interface?
Ans:
java.lang.reflect.* is used for study run time information about the class and
interface.
37. Which package is used for retrieving data from database & performing various
operation on database?
Ans:
java.sql.* is used for retrieving data from db& performing various operation on
db.
Ans:
Public access specifier.
Ans:
Default access specifier.
Ans:
Protected access specifier.