1. what is finalize & finally?
2. What is serializable i/f? - marker
3. what are string pools handled in java?
4. what is singleton classes?
5. what are hibernate sessions?
6. what is difference between jdk1.4 & 1.5, 1.6?
7. what is spring IoC?
8. What is MVC?
9. Why to use DAO?
10. Give an example of final class in java?
11. what is AGILE?
11. What is difference between eXtreame programming & TDD?
12. what is design pattern?
13. what are constructors & primitive data types in Java?
14. what are normalizations?
15. what is garbage collection & how to call?
16. what is denormalization?
17. what is method overloading & overriding?
18. what is JDBC?why?
19. What are Strem in Java?
20. What are the threading methods?
21. why to use synchization?
Friday, 16 March 2012
Thursday, 5 January 2012
Interview questions
These are few interview questions asked. The questions are based on Java and non technical. Some of the questions seems to be very simple and staight forward.
1. what is the difference between comments in java
Ans: 3 types of comments in java
a. // - which is single line comment
b. /* */ - which is to add a comment of more than one line, we can precede our comment using/*
c. /** */ -multiple line comments. Used for documentation purpose.
2. when there is a problem with the application, as a developer where we need to look at.
Ans : error logs and application server log files
3. How do you avoid deadlocks in a multithreaded enviornment?
Ans : first approach try to avoid synchronized where ever possible. If it is unavoidable, then code in such way that each thread should get lock & unlock in the same order or squence.
4. Write a Java program that:
- inputs a String from a user. Expect the String to contain spaces and alphanumeric characters only.
- capitalizes all first letters of the words in the given String.
- preserves all other characters (including spaces) in the String.
- displays the result to the user.
Answer : *
Approach : I have followed a simple approach. However there are many string utilities available
* for the same purpose. Example : WordUtils.capitalize(str) (from apache commons-lang)
/*****************************************************************************/
public static void main(String[] args) throws IOException{
System.out.println("Input String :\n");
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
String inputString = in.readLine();
int length = inputString.length();
StringBuffer newStr = new StringBuffer(0);
int i = 0;
int k = 0;
/* This is a simple approach
* step 1: scan through the input string
* step 2: capitalize the first letter of each word in string
* The integer k, is used as a value to determine whether the
* letter is the first letter in each word in the string.
*/
while( i < length){
if (Character.isLetter(inputString.charAt(i))){
if ( k == 0){
newStr = newStr.append(Character.toUpperCase(inputString.charAt(i)));
k = 2;
}//this else loop is to avoid repeatation of the first letter in output string
else {
newStr = newStr.append(inputString.charAt(i));
}
} // for the letters which are not first letter, simply append to the output string.
else {
newStr = newStr.append(inputString.charAt(i));
k=0;
}
i+=1;
}
System.out.println("new String ->"+newStr);
}
}
/*****************************************************************************/
5. How to reverse a string?
InputStreamReader inst = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(inst);
StringBuffer input = new StringBuffer(in.readLine());
System.out.println("Input String-->"+input);
System.out.print("reverse String-->");
System.out.print(input.reverse());
6. Palindrome program.
InputStreamReader instr = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(instr);
StringBuffer input = new StringBuffer(in.readLine());
StringBuffer reverseStr = new StringBuffer(input.reverse());
String inStr = input.toString().trim();
String outStr = reverseStr.toString().trim();
System.out.println(reverseStr);
if (inStr.equals(outStr)) {
//if (input.length() == reverseStr.length()) {
System.out.println("Palindrome");
//}
} else {
System.out.println("not Palindrome");
}
7. How does equals() method differs for String and StringBuffer classes?
String.equals() compares the 2 strings whereas StringBuffer.equals will return true only if compared with itself.
for comparision of strings we must use String.euqals() method or convert the StringBuffer to String and then compare.
1. what is the difference between comments in java
Ans: 3 types of comments in java
a. // - which is single line comment
b. /* */ - which is to add a comment of more than one line, we can precede our comment using/*
c. /** */ -multiple line comments. Used for documentation purpose.
2. when there is a problem with the application, as a developer where we need to look at.
Ans : error logs and application server log files
3. How do you avoid deadlocks in a multithreaded enviornment?
Ans : first approach try to avoid synchronized where ever possible. If it is unavoidable, then code in such way that each thread should get lock & unlock in the same order or squence.
4. Write a Java program that:
- inputs a String from a user. Expect the String to contain spaces and alphanumeric characters only.
- capitalizes all first letters of the words in the given String.
- preserves all other characters (including spaces) in the String.
- displays the result to the user.
Answer : *
Approach : I have followed a simple approach. However there are many string utilities available
* for the same purpose. Example : WordUtils.capitalize(str) (from apache commons-lang)
/*****************************************************************************/
public static void main(String[] args) throws IOException{
System.out.println("Input String :\n");
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
String inputString = in.readLine();
int length = inputString.length();
StringBuffer newStr = new StringBuffer(0);
int i = 0;
int k = 0;
/* This is a simple approach
* step 1: scan through the input string
* step 2: capitalize the first letter of each word in string
* The integer k, is used as a value to determine whether the
* letter is the first letter in each word in the string.
*/
while( i < length){
if (Character.isLetter(inputString.charAt(i))){
if ( k == 0){
newStr = newStr.append(Character.toUpperCase(inputString.charAt(i)));
k = 2;
}//this else loop is to avoid repeatation of the first letter in output string
else {
newStr = newStr.append(inputString.charAt(i));
}
} // for the letters which are not first letter, simply append to the output string.
else {
newStr = newStr.append(inputString.charAt(i));
k=0;
}
i+=1;
}
System.out.println("new String ->"+newStr);
}
}
/*****************************************************************************/
5. How to reverse a string?
InputStreamReader inst = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(inst);
StringBuffer input = new StringBuffer(in.readLine());
System.out.println("Input String-->"+input);
System.out.print("reverse String-->");
System.out.print(input.reverse());
6. Palindrome program.
InputStreamReader instr = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(instr);
StringBuffer input = new StringBuffer(in.readLine());
StringBuffer reverseStr = new StringBuffer(input.reverse());
String inStr = input.toString().trim();
String outStr = reverseStr.toString().trim();
System.out.println(reverseStr);
if (inStr.equals(outStr)) {
//if (input.length() == reverseStr.length()) {
System.out.println("Palindrome");
//}
} else {
System.out.println("not Palindrome");
}
7. How does equals() method differs for String and StringBuffer classes?
String.equals() compares the 2 strings whereas StringBuffer.equals will return true only if compared with itself.
for comparision of strings we must use String.euqals() method or convert the StringBuffer to String and then compare.
Tuesday, 7 June 2011
Deploy a JSP in WebLogic 10.3.4
Easy Steps :
1. Place the JSP in a new folder say Temp.
2. Create the war file using the command - jar -cvf TestJSP.war myJSP.jsp
3. Upload this war file from the weblogic deployments console
4. Access the JSP with URL - http://localhost:7001/TestJSP/myJSP.jsp
4. Access the JSP with URL - http://localhost:7001/TestJSP/myJSP.jsp
Sunday, 15 May 2011
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken
This is in sequence to my earlier post.
There are 2 ways as given below. But in my environment , I had to apply both the following steps as solution for above issue.
1. Changes in weblogic-application.xml
Add the antlr.* in the tag
----------------------------------
2. Changes in weblogic.xml
----------------------------------------
WebLogic has it's own version of ANTLR. Set the prefer-web-inf-classes element in weblogic.xml to true.
------------------------------------------------
**** take care of the closing tags in the above XMLs by opening the XML file in any browser.
There are 2 ways as given below. But in my environment , I had to apply both the following steps as solution for above issue.
1. Changes in weblogic-application.xml
Add the antlr.* in the
----------------------------------
<prefer-application-packages>
<package-name>antlr.*package-name>
prefer-application-packages>
-------------------------------------
2. Changes in weblogic.xml
----------------------------------------
WebLogic has it's own version of ANTLR. Set the prefer-web-inf-classes element in weblogic.xml to true.
<weblogic-web-app>
....
<container-descriptor>
<prefer-web-inf-classes>trueprefer-web-inf-classes>
container-descriptor>
....
weblogic-web-app>
------------------------------------------------
Tuesday, 6 April 2010
SCJP 6
here are certain links for mock exams to prepare for scjp 6.0
1.http://faq.javaranch.com/java/ScjpFaq
2. http://faq.javaranch.com/java/ScjpMockTests
3. http://examlab.tk/
Examlab is tough, but if you get 50% of score, then it is almost sure that you can pass the SCJP
All the very best!!
1.http://faq.javaranch.com/java/ScjpFaq
2. http://faq.javaranch.com/java/ScjpMockTests
3. http://examlab.tk/
Examlab is tough, but if you get 50% of score, then it is almost sure that you can pass the SCJP
All the very best!!
Saturday, 16 January 2010
ICICI has removed the NEFT charges & HDFC introduced NEFT charges:)
Finally ICICI Bank not charging for the online transactions. That is good news for this new year!!!
But HDFC introduced the NEFT charges....
But HDFC introduced the NEFT charges....
Real Estate comparison in Bangalore and Trivandrum
This is a just my observation about the real estate market in Bangalore and Trivandrum. I recently bought a plot in Bangalore !( can not say it is in Bangalore as the place is very far away from Bangalore city.)
I purchased a 2064 sq ft in xxxxhalli :-) in Old Madras Road. It is very near to the Volvo factory in Bangalore. It cost me around 9 lacs. I am not sure whether it was a good deal or not. But later I found that the local people sold that area to the builders for about INR 225 per sq ft. This is a rough calculation. But having said that, I am getting the advantages of a fully built Township features at my place. So I am consoling myself. :)
I bought a flat in Trivandrum in 2008. It is a 3 BHK & cost me 34 lacs. Again at that time I was hoping to increase the price of flat in future, but now if I buy the same flat, there is hardly any change in price or no change.
But at that time I had inquired the price in Bangalore as well. The price is drastically changed during these period.
But I know that the market value for a city like Bangalore is nothing comparable to Trivandrum and again I will say that it is good that the flat price has not come down in Trivandrum even at the rescission time:)
I purchased a 2064 sq ft in xxxxhalli :-) in Old Madras Road. It is very near to the Volvo factory in Bangalore. It cost me around 9 lacs. I am not sure whether it was a good deal or not. But later I found that the local people sold that area to the builders for about INR 225 per sq ft. This is a rough calculation. But having said that, I am getting the advantages of a fully built Township features at my place. So I am consoling myself. :)
I bought a flat in Trivandrum in 2008. It is a 3 BHK & cost me 34 lacs. Again at that time I was hoping to increase the price of flat in future, but now if I buy the same flat, there is hardly any change in price or no change.
But at that time I had inquired the price in Bangalore as well. The price is drastically changed during these period.
But I know that the market value for a city like Bangalore is nothing comparable to Trivandrum and again I will say that it is good that the flat price has not come down in Trivandrum even at the rescission time:)
Subscribe to:
Posts (Atom)