majohnad majohnad

Greenhorn
+ Follow
since Jan 01, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by majohnad majohnad

What will be the value of variable "totalParams" after line 7;if the following code is executed from command line as - java -ea AssertTest?
(Assume that the code is compiled and run with assertions enabled)

1.public class AssertTest
2.{
3.public static void main(String args[])
4.{
5.int count = args.length;
6.assert (Math.abs(count) == count);
7.int totalParams = count;
8.//more code
9.}
10.}
The Ans for the above question is given
It will throw an AssertionError at runtime at line 6, and statements after that line are not executed;hence value of totalParams can not be determined
I think this is wrong, it will print 0 as output.
kindly correct me If i am wrong..
Thanks in advance.
In the below question, in which line the String created s2 in line 3 is available for garbage collection?
My Ans is : Line 5. It is correct??

1. String s = "abcd";
2. Integer x = new Integer(3);
3. String s2 = s + 4;
4. s2 = null;
5. s = null;
Thanks in Advance
�HashMap is thread-safe whereas HashTable is not
The above statement is true/false??
Which of the following classes implement java.util.Map interface?
A) Hashtable
B) HashMap
C) Dictionary
D) IdentityHashMap
E) Vector
what is the correct ans for the above question?
Hi,
This question is confusing me, The question is
to find out the reserved word or keyword?
Because, if i am right, reserved words are const,goto. there is no reserved words in the question below.........

Which is a reserved word in the Java programming language? (Choose one.)
A. method
B. native
C. subclasses
D. reference
E. array
Hi,
3.13) Which of these statements are true?
Select all valid answers:
(a) Transient variables will not be saved during serialization.
(b) Constructors can be declared abstract.
(c) The initial state of an array object constructed with the statement int a[] = new int[10] will depend on whether the variable a[] is a local variable, or a member variable of a class.
(d) Any subclass of a class with an abstract method must implement a method body for that method.
(e) Only static methods can access static members.
which are all true in the above question?
Hi
" Objects themselves don not have visibility, only references to the object "
I did't get this point.
The ans says it is true?
Bye
Hi Friends,
I am taking exam in the next week. Kindly give me some suggestions/Tips that helps me before I take exam/ at the time of exam.
Thanks in Advance.
Hi,
void method X() {
String r = new String("abc");
String s = new String("abc");
r = r+1; //1
r = null; //2
s = s + r; //3
} //4

In the above code in which line s is available for garbage collection.
Thnaks in Advance
String datetime = "08/27/2002";
How to convert String to Date .
21 years ago
Is the below statements are true?
"An abstact class must declare at least one abstract method"
"A local class can be declared abstract."
HI,
1. System.out.println(3>>1)
2. System.out.println(-3>>>1);
the answer for 1 is :1 this is clear.
I am not clear how the answer for 2 is 2147483646
any one explain clearly.
HI,
Which of the following statements are correct about interfaces?


1. Property fields in interface are automatically defined as coderanch, static and final.
2. Property fields in interface are automatically defined as static and final only.
3. Properties defined in interface must contain uppercase characters.
4. Interfaces use the keyword implements to ensure multiple inheritance.
5. Classes implementing interface must implement each method defined in the interface.
what are the correct answers?
In regard to constructors, how can you prevent a class from being instantiated?
A. Use the private declaration.
B. Use anonymous classes.
C. Employ overloading.
D. Use only static inner classes.
the answer is given as A, why can't be B.
Thanks in Advance.
Under what circumstances might you use the yield method of the Thread class
1) To call from the currently running thread to allow another thread of the same or higher priority to run
2) To call on a waiting thread to allow it to run
3) To allow a thread of higher priority to run
4) To call from the currently running thread with a parameter designating which thread should be allowed to run
My Answer is 2. is it correct? If not how? pls explain....
Which is the correct Answer.