Various java questions: 1) What is a binary search? 2) How to use an array to do
ID: 3557467 • Letter: V
Question
Various java questions:
1) What is a binary search?
2) How to use an array to do it?
3) What is a 2D aray and how do you determine where the values are stored?
4) How do you determine row lengths and columns of a 2D array?
5) How are the elements of an array passed through a method or can they be?
6) What is a character wrapper class?
7) What are wrapper classes used for?
8) How does one incorporate wrapper classes into your programming?
9) What are the methods available to you when you work with char wrapper classes?
10) How do you academitate/concatenate string?
11) What is a string buffer?
12) What is a string token?
13) What is a delimiter?
14) Can you have more than one delimiter?
15) How do you assign values to a wrapper class object?
16) What are static fields?
17) What is a static method?
18) What is a 2 string method?
19) How do you compare objects?
20) What is a deep copy?
21) What is an enumerated type?
22) Are there any limitations on static methods?
23) How do you create enumerated data types?
24) What does it mean to have a class method named final?
Explanation / Answer
1. binary search is an algorithm to search a element from a sorted array so using this algorithm we can search an element from a sorted array faster.
2. create a single dimensional array and if it sorted then its okay otherwise sort it first then apply binary search.
3. we can think as two dimensional array as array of array. eg int array[][] = new int[3][3]
and we can find element like array[2][0] or simplay you can think a 2 dimensional array as a mmatrix in maths.
let int arra[][] = new int[3][3];
to find row length int l = array.length;
to find column length int c = array[0].length;
5. just like variable fun(array);
6. Character wrapper class hold the character in the form of object so that you can execute built in method for that character object.
7. wrapper call represent the built in(primitive type) as object. to support OOP concept.
8. Database support null values so in order to store any object from our java program for not applicable we should have null value which boilt in type does not support so to create Object Relation mapping we should have wrraper object rahter than primitive type.
9. go through API.
10. String s1 = new String("A"); String s2 = new String("B");
s1.concat(s2);
11. StringBuffer is same as string class but it is thread safe.
12. StringToken is a class having built in methods to tokenise the string object.
13. Delimiter is seprator which in nothing but comma(,) in java.
14. yes.
15. Directly Integer i = 10 or Integer i = new Integer(10)
16. static filed are those which exist for class not for object.
17. static method are those which exist at class level not for object leval you can execute static method directly without creating objet of class.
18. toString method is Object class method which is responsible to print the content of object.
19. using comparator or comparable.
20. deep copy means copying all the data member.
21. Enumerated type is used to make the named constants.
22. yes.
23. enum e = {"a","b"};
24. the you cannot override it in child class.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.