![]() |
| Home | Tech FAQ | Interview Questions | Placement Papers | Tech Articles | Learn | Freelance Projects | Online Testing | Geeks Talk | Job Postings | Knowledge Base | Site Search | Add/Ask Question |
![]() Related Questions Which of the following 2 methods executes faster ?class Trial { String _member; void method1() { for(int i=0;i<2048;i++) { _member += "test"; } } void method2() { String temp; for(int i=0;i<2048;i++) { temp += "test"; } _member = temp; } } (a) method1() (b) method2() (c) Both method1() and method2() takes same time for execution (b)Accessing method variables requires less overhead than accessing class variables. (a) Latest Answer : an exception of NumberFormat will be thrown ... How many String objects are created by the following statements ?String str = " a+b=10 "; trim(str) str.replace(+,-);(a) 1 (b) 2 (c) 3 (d) 4 (c)Strings are immutable. So, for each String operation, one new object is generated. Latest Answer : Interface is design on which class is built.Interface is a java defined type. ... Latest Answer : Static Methods over loading is of no use for example the below code will produce a output of B.m1 C.m1 C.m1 if we remove static in those functions we will get an ouput of B.m1 C.m1 B.m1 class C{ static ...
Sponsored Links
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||