Requirement is to search a particular String in the Array of String value. To achieve this we need to have some set string values in a String array and secondly we need to have a String value to be searched.
Tips to Proceed...
1. Take counter
2. Iterate String and match the value on each iteration using equals() method.
Steps to do....
1. Take a counter count=0 .
2. Get the String to be searched.
3. Iterate the String Array and...
The above question means that we need to execute some line of code which perform something before the main() method execution. As we know that when we execute our program JVM will call main() at very first , so it seems that its not possible to perform something before the main() method execution but is possible with the static initialization block and calling method while initializing static variable
Important Points :
1. Static initialized...
This question might be asked in as interview to judge logic on how you are going to achieve without providing you the length() method to calculate the String length easily.
Tips to Think ....
1. As we know that in Java String doesn't end with the NULL character with in C it ends with the NULL character.
2. To get to the end of String we have nothing as a mark in Java but in C we can check for the NULL character.
3. Now have to think to...
This is a interview question can be asked in an experienced or fresher's interview to write a program which will add up all the integer value present in a string and print the added number.
Tips to think how to do it...
1. For this kind of problem always think of first matching the number in a String .
2. How you are going to match?
3. The only simplest way is with the help of ASCII of 0-9 .
Steps to do :
1. Take a int variable...
This is one of the important and mostly asked question in fresher and experienced interview. Singleton class means a class with only one object. It will have only one object which will be returned always when ever we try to create the object of singleton class. We can create our own singleton class. Interviewer will ask you to write your own singleton class, for that you need to remember following points to create your own singleton class :
a)...
This is one of the common question to be asked in interview to judge your basic level of knowledge. We all know that String is immutable which means that once object created cannot be modified or if try to modify, it will create another String literal in the String pool. So this proves that String is immutable, but this is we are proving theoretically. Now if interviewer ask you to prove the same by writing programs then you will be doing like...
Subscribe to:
Posts (Atom)