This function is to check whether the given parameter is number or not...
public static boolean isNumber(String str){
boolean number=false;
try{
Integer.parseInt(str);
number=true;
}catch(NumberFormatException n){
number=false;
}
return number;
}
Thursday, February 5, 2009
Wednesday, January 14, 2009
Java Servlets
Servlets are server side components that provide a powerful mechanism for developing server side programs. Servlets provide component-based, platform-independent methods for building Web-based applications
, without the performance limitations of CGI programs. Unlike proprietary server extension mechanisms (such as the Netscape Server API or Apache modules), servlets are server as well as platform-independent. This leaves you free to select a "best of breed" strategy for your servers, platforms, and tools. Using servlets web developers can create fast and efficient server side application which can run on any servlet enabled web server. Servlets run entirely inside the Java Virtual Machine. Since the Servlet runs at server side so it does not checks the browser for compatibility. Servlets can access the entire family of Java APIs, including the JDBC API to access enterprise databases. Servlets can also access a library of HTTP-specific calls, receive all the benefits of the mature java language including portability, performance, reusability, and crash protection. Today servlets are the popular choice for building interactive web applications. Third-party servlet containers are available for Apache Web Server, Microsoft IIS, and others. Servlet containers are usually the components of web and application servers, such as BEA WebLogic Application Server, IBM WebSphere, Sun Java System Web Server, Sun Java System Application Server and others. Servlets are not designed for specific protocols. It is different thing that they are most commonly used with the HTTP protocols Servlets uses the classes in the java packages javax.servlet and javax.servlet.http. Servlets provides a way of creating the sophisticated server side extensions in a server as they follow the standard framework and use the highly portable java language.
, without the performance limitations of CGI programs. Unlike proprietary server extension mechanisms (such as the Netscape Server API or Apache modules), servlets are server as well as platform-independent. This leaves you free to select a "best of breed" strategy for your servers, platforms, and tools. Using servlets web developers can create fast and efficient server side application which can run on any servlet enabled web server. Servlets run entirely inside the Java Virtual Machine. Since the Servlet runs at server side so it does not checks the browser for compatibility. Servlets can access the entire family of Java APIs, including the JDBC API to access enterprise databases. Servlets can also access a library of HTTP-specific calls, receive all the benefits of the mature java language including portability, performance, reusability, and crash protection. Today servlets are the popular choice for building interactive web applications. Third-party servlet containers are available for Apache Web Server, Microsoft IIS, and others. Servlet containers are usually the components of web and application servers, such as BEA WebLogic Application Server, IBM WebSphere, Sun Java System Web Server, Sun Java System Application Server and others. Servlets are not designed for specific protocols. It is different thing that they are most commonly used with the HTTP protocols Servlets uses the classes in the java packages javax.servlet and javax.servlet.http. Servlets provides a way of creating the sophisticated server side extensions in a server as they follow the standard framework and use the highly portable java language.
Thursday, December 25, 2008
1.Class C {
public static void main(String[] args) {
int[]a1[]=new int[3][3]; //3
int a2[4]={3,4,5,6}; //4
int a2[5]; //5
}}
What is the result of attempting to compile and run the program ?.
1.compiletime error at lines 3,4,5
2.compiltime error at line 4,5
3.compiletime error at line 3
4.Runtime Exception
5.None of the above
Ans: 2
Explanation:
no value shoud be specified in the rightsidebrackets when constructing an array
2. interface I{
void f1(); // 1
public void f2(); // 2
protected void f3(); // 3
private void f4(); // 4
}
which lines generate compile time errors?
1.compiletime error at lines 1,2,3,4
2.compiletime error at line 3
3.compiletime error at line 1
4.compiletime error at lines 3,4
5.None of the above
Answer: 4
Explanation:
all methods declared within an interface are implicitly public, a weaker access level can not be declared.
3)
class C{
int i;
public static void main (String[] args) {
int i; //1
private int a = 1; //2
protected int b = 1; //3
public int c = 1; //4
System.out.println(a+b+c); //5
}}
1.compiletime error at lines 1,2,3,4,5
2 compiletime error at lines 2,3,4,5
3.compiletime error at lines 2,3,4
4.prints 3
5.None of the above
Answer 2
Explanation:
The access modifiers public, protected and private, can not be applied to variables declared inside methods.
public static void main(String[] args) {
int[]a1[]=new int[3][3]; //3
int a2[4]={3,4,5,6}; //4
int a2[5]; //5
}}
What is the result of attempting to compile and run the program ?.
1.compiletime error at lines 3,4,5
2.compiltime error at line 4,5
3.compiletime error at line 3
4.Runtime Exception
5.None of the above
Ans: 2
Explanation:
no value shoud be specified in the rightsidebrackets when constructing an array
2. interface I{
void f1(); // 1
public void f2(); // 2
protected void f3(); // 3
private void f4(); // 4
}
which lines generate compile time errors?
1.compiletime error at lines 1,2,3,4
2.compiletime error at line 3
3.compiletime error at line 1
4.compiletime error at lines 3,4
5.None of the above
Answer: 4
Explanation:
all methods declared within an interface are implicitly public, a weaker access level can not be declared.
3)
class C{
int i;
public static void main (String[] args) {
int i; //1
private int a = 1; //2
protected int b = 1; //3
public int c = 1; //4
System.out.println(a+b+c); //5
}}
1.compiletime error at lines 1,2,3,4,5
2 compiletime error at lines 2,3,4,5
3.compiletime error at lines 2,3,4
4.prints 3
5.None of the above
Answer 2
Explanation:
The access modifiers public, protected and private, can not be applied to variables declared inside methods.
Wednesday, November 19, 2008
Break
The break statement is used in many programming languages such as c, c++, java etc. Some times we need to exit from a loop before the completion of the loop then we use break statement and exit from the loop and loop is terminated. The break statement is used in while loop, do - while loop, for loop and also used in the switch statement.
Code of the program :
public class Break{ public static void main(String[] args){ int i,j; System.out.println("Prime numbers between 1 to 50 : "); for (i = 1;i < j =" 2;j" j ="="" i ="="">
Thursday, August 28, 2008
JDBC Tutorials
JDBC - Java Database Connectivity Tutorials
JDBC Tutorial, Java Database Connectivity Tutorial, Tutorial Database.www.roseindia.net/jdbc/jdbc.shtml - 68k - Cached - Similar pages
JDBC Tutorial, Java Database Connectivity Tutorial, Tutorial Database.www.roseindia.net/jdbc/jdbc.shtml - 68k - Cached - Similar pages
Wednesday, August 20, 2008
PHP Tutorial
Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building. ... PHP Tutorial. PHP Tutorial ...www.w3schools.com/php/default.asp
Compressing and Decompressing Data using Java
Compressing and Decompressing Data using Java APIs ... An output stream filter for compressing data in the deflate compression format. GZIPInputStream ...
java.sun.com/developer/technicalArticles/Programming/compression
java.sun.com/developer/technicalArticles/Programming/compression
Subscribe to:
Posts (Atom)