Why class class is always the super class for every class
1. Object is super class for all java classes.
2. even if someone want to make a class as subclass of CLASS class, he cant because class class is declared as final. so it can not be inherited
java.lang.Object is the super class of all classes and NOT Class class
vinny
What are the difference between Java.SQL package and Javax.SQL package
javax.sql provides connection pooling ,distributed transaction,disconnected rowsets
java.sql.* package is used for the basic jdbc connections.
javax.sql.* package is used for the advance jdbc. Advance is connection pooling, rowsets...ect.
How many ways we can create object ?
We can create an object in java by six ways.......
1.new operator
2.class.forName
3.Factory Method
4.Cloning
5.Deserialization
6.Reflection API
In 5 ways
1. New operator
2. New instance
3. Clone
4 Factory method
5 De-Serialization
Is Java a fully object oriented programming or not? If not why?
java does not support multiple parenting.
Pradeep, Does java supports Switch/Case trype of branching? Is this an OOPS concept?
What is difference between checked and unchecked exception ?
Checked Exception represents the External Failure while Unchecked Exception represents the Internal failure.
checked exceptions must be handeled.That is, a try-catch must either be nested around the call to the method that throws the exception.The compiler will throw an ...
What are the differences between arraylist and a vector
Array is a set of related data type and static whereas vector is a grow able array of objects and dynamic
AL-non legecy/methods are not sysnchronized
Vector-legecy/method are synchronized
Where should we use exactly abstract class and interfaces?
All the methods declared inside an interface are abstract whereas abstract class must have at least one abstract method and others may be concrete or abstract. b) In abstract class, key word abstract...
If a class cannot be static how can an inner class alone be static ?
First ask yourself the question as to why is static used? Static helps us use those static members of the class directly, without creating an object. Second of all the outer classes are already perc...
What happens if public static void main(){} is made protected?
Answered by: Sushil Jain
Answered On : Nov 21st, 2007You will be able to compile but it will through a run time error saying "main method not public".
It will compile but gives error at run time......
The complier will throw error that there is no main() method. main() should be public always please note.
Explain when Java application can run out of memory ?
if you have an infinite loop that keeps on doing things that take up memory (like creating objects).
We all know Java automatically garbage collects unused objects. But you must remember that an object is considered as unused only when the object no longer referenced. That means a referenced class continues to exist and to take up memory space even if it is not used.
What is the difference between a callablestatement and preparedstatement?
Prepared statements can also execute a sql block or stored procedure.
But advantage of callable statement is it has registerOutParameter option.
If you want the OUT param value, you need to use CallableStatement alone.
PreparedStatement:
Use when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime
CallableStatement:
Use when you want to access database stored procedures. The CallableStatement interface can also accept runtime input parameters.
What is mean by taking "build"? And which processes and modules of an application involved while taking builds.
How to expire .Jar file after specific time interval like free antivirus?
What is the repeater function...And what does data integrity means?
The correctness and consistency of stored data is known as integrity of data.
Ans:2
You are right Sandeep.
But I guess, Sadashivrao did not set a classpath if he is executing this program on command prompt.
You can set classpath by:(if u saved Return.java in temp folder)
C:Documents and Settingsx.yDesktoptemp>set classpath=%classpath%;
C:Documents and Settingsx.yDesktoptemp
How does garbage collection work
gc called by jvm we dont hav any contol
When Java was originally developed, the JDK shipped with a mark-and-sweep garbage collector. A mark-and-sweep garbage collector proceeds in two phases: Mark: identifies garbage objects Sweep: reclaims...
Abstract - how do you make object
If all the methods in the abstract class is defined, then it is a abstract class? And can we make object out of it?
we cant create the instance of abstract class ..here we need sub class which extended this class .we can have ref var of abstract class
First thing first, An abstract class without any abstract method means you are loosing the main intent fo abstractness, why we are making abstract class is to provide some of common implementation and...
What is the output of the following program?Class a{ public static void main(string[] s) { system.Out.Println(s[1] + s[2] + s[3]);}}Java a 12345options(i) 1(ii) 12(iii)1234(iv)234(v) compilation error
Answered by: abuthahir.d
Member Since Jan-2008 | Answered On : Apr 14th, 2008
Khadar , i tried this code . it gives that exception
for the foll reason :
when u give a CLA(command line argument) , it will be inserted in the index 0 of the array and then will proceed to 1 ,2 ....
so as per the question , "12345" will be at s[0] . and length of that aray will be 1when u try to access s[1] , we are trying for 2nd element which is unavailable.....
Hope this answers u :-)
Compilation error . System.out.println() is the syntaz not system.Out.Println
arrayOutOfBoundException
Sort an arraylist having group of objects
Employee object having emp name, emp id, emp salary... An arraylist has a list of employee object.How will you sort this arraylist?
Implement the Comparator Interface for the Employee Class. Then customize your sort in the implemented method from interface
Implement Comparable interface for the class Employee, customize your require in the implemented method from interface
static variable can not be serialized.... please follow find below example. Test3==> "java package a.b.c.d.e; import java.io.FileInputStream; import java.io.FileOutputStream;...
No static variables can't be serialzed......
any doubts, let me know i can give an example???