Tuesday 7 May 2013

List Of Full Form of Domain Names Extensions

List Of Full Form of Domain Names Extensions

.com → commercial Internet sites.
.edu → educational sites .
.firm → for an Internet site for a business.
.gov → for a U.S. government site on the Internet.
.int → international institutions.
.mil → for a U.S. military site on the Internet.
.mobi → for mobile phones.
.nato → for NATO sites.
.net → for Internet administrative sites.
.nom → for a personal site on the Internet.
.org → for organizational Internet sites.
.store →for a retail business.
.web → for an Internet site that is about the World Wide Web.
.in → India
.Us → united states
.uk united kindom

Sunday 21 April 2013

What is a JAR file in Java


What is a JAR file in Java.

JAR file is the compressed file format. You can store many files in a JAR file. JAR stands for the Java Archive. This file format is used to distribute a set of java classes. This file helps you to reduce the file size and collect many file in one by compressing files. Downloading the files are become completed in very short duration of time because of reducing the file size. You can make the jar file executable by collecting many class file of your java application in it. The jar file can execute from the javaw (Java Web Start).
The JAR file format is based on the popular ZIP file format. Usually these file format is not only used for archiving and distribution the files, these are also used for implementing various libraries, components and plug-ins in java applications. Compiler and JVMs (Java Virtual Machine) can understand and implement these formats for java application.
For mentioning the product information like vendor name, product version, date of creation of the product and many other things related to the product are mentioned in the manifest file. Such type of files are special which are mentioned in the jar file for making it executable for the application. This file format is to be used for collecting auxiliary files associated with the components.

To perform basic operations for the jar file there has to be used the Java Archive Tool (jar tool). It is provided by the jdk (Java Development Kit). Following are some jar command which are invoked by the jar tool:
FunctionsCommand
creation a jar file
viewing contents of a jar file
viewing contents with detail of a jar file
extract all the files of a jar file
extract specific files from the jar file
update jar files
running a executable packaged jar file
jar cf jar-file-name file-name(s)_or_directory-name
jar tf jar-file-name
jar tvf jar-file-name
jar xf jar-file-name
jar xf jar-file-name file-name(s)_from_jar-file
jar uf jar-file-name file-name(s)_from_jar-file
java -jar jar-file-name

What Is Javadoc?


What Is Javadoc?

Javadoc is a program shipped with JDK that you can use to run over your source code to produce documentation of your classes in the same type of HTML files that Sun Microsystems has used for its Java API documentation. To use javadoc on your source code, you have to tag your code with a certain type of comment formats. A simple example of Javadoc comments looks like this:
 
/** 
* Class MyButton implements java.io.Serailizable,
extends java.awt.Button 
*/ 
public class MyButton 
{ 
/** 
* Does nothing interesting 
* 
* @param image the image to show on button 
* @param label text to show on button 
*/ 
public MyButton(String label, Image image) 
{ 
//code here 
} 
//rest of class here 
} 
Javadoc comments start with /**, end with */, and, in-between, use tags such as @param, @return, and @exception to describe the workings of a method.
Extracted comments are processed into a set of HTML files for later perusal by a web browser. Using Javadoc, you can view the class hierarchy, an index of all methods and fields, and the details of each class.
The nice thing about Javadoc comments is that you can embed HTML tags to format your text. For example:
 
/** 
* <B>The Use Of This Class is Prohibited By Law.</B> 
*/ 
will make "The Use Of This Class is Prohibited By Law." appear in bold.

Monday 8 April 2013

Basics core java questions and answers

Basics core java questions and answers 
(1) Which of the following option is not true about java programming language? 

(a) Java is high level programming language.
(b) Java is a platform.
(c) javac is compiler.
(d) Byte code is executed by CPU. 

Answer: (d)

(2) Which is a not characteristic of java programming language? 

(a) Robust
(b)Procedural
(c) Distributed
(e) Multithreaded

Answer: (b)

(3) Which of the following is true about of java hotspot virtual machine? 

(a) It is additional virtual machine which improves the performance of an application.
(b) It is internal device which convert source code into byte code.
(c) It is virtual machine which detects runtime exception.
(d) All are true.

 Answer: (a)

(4) Which of the following is correct?

(a) Java platform is software only platform that runs on the top of other hardware based platform. 
(b) Java platform has two components: JVM, API.
(c) Java technology is programming language as well as platform
(d) All of the above.

Answer: (d) 

(5) Which of them is a not command line tool?

(a) java
(b) javaw
(c) javapath
(d) javadoc 

Answer: (c) 

(6) Which of the following is correct about main method in java?

(a) Must be declared as public. 
(b) It must not return any value.
(c) Must be declared as static.
(e) Must accept string as a parameter.
(f) Above all are compulsory. 
(g) All are optional.

 Answer: (f)

(7) Which not true about API in java?

(a) API stands for application package interface. 
(b) It is large collection of software components.
(c) It is large array of useful class.
(d) It is grouped into the package of related class. 

Answer: (a) 

(8) Which of the following is correct? 

(a)

class MainClass {
     static public void main(String[] args) {
          System.out.println("Hello World!");
     }
}

(b)

class MainClass {
     public static void main(String[] args) {
          System.out.println("Hello World!");
     }
}

(c)

 class MainClass {
      static public int main(String[] args) {
           System.out.println("Hello World!");
           return 1;
     }
}

(d) Both option (a) and (b)

 Answer: (d) 

(9) Which of the following is not true in java? 

(a) Java platform is bit faster than actual CPU platform.
(b) javac is compiler tool. 
(c) java command launch an application. 
(d) javadoc is documentation tool. 

Answer: (a) 

(10) What is difference between following two commands?

(i) java ClassName
(ii)javaw ClassName

Where ClassName.class is name of any class file. 

(a) Execution time of (i) is faster than (ii) 
(b) (i) is used to run in server machine while (ii) is used to run in client machine.
(c) (ii) is used to run in server machine while (i) is used to run in client machine. 
(d) (i) has console window while (ii) has not any console window. 

Answer: (d) 

(11) If any class file Binary.class is zipped in Binary.zip at c:\Test. Which of the following command line command is suitable to execute the zip file?

(a) java –classpath c:\Test\Binary.zip Binary
(b) java –cp c:\Test\Binary.zip Binary
(c) javaw –classpath c:\Test\Binary.zip Binary 
(d) javaw –cp c:\Test\Binary.zip Binary
(e) All of them are correct.

Answer: (e) 

(12) How can we set the following two path of class folder at a time in command prompt?

(i) c:\test
(ii) Current working directory.

(a) set classpath=c:\test;.
(b) set -cp=c:\test;.
(c) path=c:\test;. 
(d) PATH=. ; c:\test 

Answer: (a) 

(13) If Binary.class is present is at both of following directory

(i) c:\test
(ii) d:\raja

Which of them is true if following command is executed in the command prompt?

set cp=c:\test;d:\raja java Binary

(a) Binary.class, which is present in test folder will execute only.
(b) Binary.class, which is present in raja folder will execute only. 
(c) Binary.class, which are present in test and raja folders both will execute. 
(d) It will depend upon O.S.

 Answer: (a)



Blog Author: Vijay Kumar

Saturday 30 March 2013

Is it possible to communicate from an applet to servlet and how many ways and how?


Is it possible to communicate from an applet to servlet and how many ways and how?  
Yes, there are three ways to communicate from an applet to servlet and they are: a) HTTP Communication(Text-based and object-based) b) Socket Communication c) RMI Communication

Blog Author: Vijay Kumar


What is session tracking and how do you track a user session in servlets?


What is session tracking and how do you track a user session in servlets?  
Session tracking is a mechanism that servlets use to maintain state about a series requests from the same user across some period of time. The methods used for session tracking are: a) User Authentication occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password. b) Hidden form fields fields are added to an HTML form that are not displayed in the client’s browser. When the form containing the fields is submitted, the fields are sent back to the server. c) URL rewriting every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information, added parameters or some custom, server-specific URL change. d) Cookies a bit of information that is sent by a web server to a browser and which can later be read back from that browser. e) HttpSession- places a limit on the number of sessions that can exist in memory. This limit is set in the session. maxresidents property.


Blog Author: Vijay Kumar


Wednesday 27 March 2013

How many ways can we track client and what are they?


How many ways can we track client and what are they? 
 The servlet API provides two ways to track client state and they are: a) Using Session tracking and b) Using Cookies.



Blog Author: Vijay Kumar

What are the different servers available for developing and deploying Servlets?


What are the different servers available for developing and deploying Servlets?  
a) Java Web Server 
b) JRun 
g) Apache Server 
h) Netscape Information Server
 i) Web Logic

Blog Author: Vijay Kumar


Who is loading the init() method of servlet?


Who is loading the init() method of servlet?  

Web server

Blog Author: Vijay Kumar


What is the life cycle of a servlet?


What is the life cycle of a servlet?  
Each Servlet has the same life cycle: 
a) A server loads and initializes the servlet by init () method. 
b) The servlet handles zero or more client’s requests through service() method. 
c) The server removes the servlet through destroy() method.

Blog Author: Vijay Kumar


What is the difference between doPost and doGet methods?


What is the difference between doPost and doGet methods?  
a) doGet() method is used to get information, while doPost() method is used for posting information. b) doGet() requests can’t send large amount of information and is limited to 240-255 characters. However, doPost()requests passes all of its data, of unlimited length. 
c) A doGet() request is appended to the request URL in a query string and this allows the exchange is visible to the client, whereas a doPost() request passes directly over the socket connection as part of its HTTP request body and the exchange are invisible to the client.

Blog Author: Vijay Kumar


What is the difference between an applet and a servlet?


What is the difference between an applet and a servlet?  
a) Servlets are to servers what applets are to browsers. b) Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.

Blog Author: Vijay Kumar


What is servlet?


What is servlet? 
 Servlets are modules that extend request/response-oriented servers, such as java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database.

Blog Author: Vijay Kumar


How to create and call stored procedures?


How to create and call stored procedures?  
To create stored procedures: Create procedure procedurename (specify in, out and in out parameters) BEGIN Any multiple SQL statement; END; To call stored procedures: CallableStatement csmt = con. prepareCall(”{call procedure name(?,?)}”); csmt. registerOutParameter(column no. , data type); csmt. setInt(column no. , column name) csmt. execute();



Blog Author: Vijay Kumar

What is stored procedure?


What is stored procedure?  
Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and executed with different parameters and results and may have any combination of input/output parameters.

Blog Author: Vijay Kumar


What are the types of statements in JDBC?


What are the types of statements in JDBC?  
Statement: to be used createStatement() method for executing single SQL statement PreparedStatement — To be used preparedStatement() method for executing same SQL statement over and over. CallableStatement — To be used prepareCall() method for multiple SQL statements over and over.

Blog Author: Vijay Kumar


What type of driver did you use in project?


What type of driver did you use in project?  
JDBC-ODBC Bridge driver (is a driver that uses native(C language) libraries and makes calls to an existing ODBC driver to access a database engine).

Blog Author: Vijay Kumar


What are the steps involved for making a connection with a database or how do you connect to a database?


What are the steps involved for making a connection with a database or how do you connect to a database?
a) Loading the driver : To load the driver, Class. forName() method is used. Class. forName(”sun. jdbc. odbc. JdbcOdbcDriver”); When the driver is loaded, it registers itself with the java. sql. DriverManager class as an available database driver. b) Making a connection with database: To open a connection to a given database, DriverManager. getConnection() method is used. Connection con = DriverManager. getConnection (”jdbc:odbc:somedb”, “user”, “password”); c) Executing SQL statements : To execute a SQL query, java. sql. statements class is used. createStatement() method of Connection to obtain a new Statement object. Statement stmt = con. createStatement(); A query that returns data can be executed using the executeQuery() method of Statement. This method executes the statement and returns a java. sql. ResultSet that encapsulates the retrieved data: ResultSet rs = stmt. executeQuery(”SELECT * FROM some table”); d) Process the results : ResultSet returns one row at a time. Next() method of ResultSet object can be called to move to the next row. The getString() and getObject() methods are used for retrieving column values: while(rs. next()) { String event = rs. getString(”event”); Object count = (Integer) rs. getObject(”count”);

Blog Author: Vijay Kumar