Win a copy of Spring in Action (5th edition) this week in the Spring forum!

Mike Kelly

Ranch Hand
+ Follow
since Jul 18, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Kelly

Thanks Dan. Will give it a shot. Looking forward to the Assertions section.
I've only seen one, I forgot who does it, but it's expensive. Wonder if it's worth the price. Any suggestions anyone? Thanks for any help.
Thanks Jose and Dave, I guess I spaced out. here's my own notes.
43. When we pass references in Java, what actually gets passed is the value of that reference i.e. the memory address of the object being referenced. When changes are made to the object itself, those changes are reflected on that object even outside of the method making the call. But any changes to the reference itself do not reflect outside of the method call. But does inside the method call .
16. Variables declared in methods are not accessible from any other method. (Compiler error).
Variables declared within blocks, have the scope of the block. (loop for example)
3) Consider the following code,
public class Test {
public static void main(String args[]) {
StringBuffer a = new StringBuffer("One");
StringBuffer b = new StringBuffer("Two");
Test.swap(a,b);
System.out.println("a is "+ a +"\nb is " + b);
}
static void swap (StringBuffer a, StringBuffer b) {
a.append(" more");
b=a;
}
}
What will be the output?

Ans given is: a one more
b is two.
I answered a is one more, b is one more. Don't understand why b is assigned two?
Excellent Corey thank-you.
class MyClass
{
public static void main(String []args)
{
final int i = 100;
byte b = i;
System.out.println(b);
}
}
------------------------------------------------
class MyClass
{
public static void main(String []args)
{
int i = 100;
byte b = i;
System.out.println(b);
}
}
-----------------------------------------------
The top class compiles and prints 100. The bottom class gives compiler error, stating possible loss of percision, why please?
Arun, Jamal, I don't want to bash Jqplus, I bought it, the questions are good, but I also found the support to be lacking. I just come here instead for support. Of course you'll need them for an incomplete file.
I got it guys, thanks alot. Seems I had a previous exam question that led me down that path. The Moose Saloon is a great resource for people trying to learn this very complicated subject. Very much appreciated.
Doesn't the false evaluation of the two ints, equal the false boolean flag? Isn't it TRUE that false equals false?
Thanks, Jqplus gave the answer as A & E.
Jq-plus Question 955386656992
boolean b1 = false;
int i1 = 2;
int i2 = 3;
if (b1 = i1 == i2)
{
System.out.println("true");
} else
{
System.out.println("false");
}

It will print true.
It will print false.
Correct ans given is false. I disagree because of precedence of operations. The two ints are unequal, which equal the boolean(false) which evaluates to true no? Thanks
Question ID :955554894422
Which variables of the encapsulationg class, can an inner class access if the inner class is defined in a static method of encapsulating class?
a. All static variables
b. All final instance variables
c. All automatic variables
d. All instance variables
e. All final automatic variables

Sorry, I'm not familiar with the term automatic variables. Could someone please explain? Thanks.
Thanks Corey for clearing up that loose end.
The following code compiles fine. I would like to know why variable c, a local variable, is not explicitly initililized? Do local variables need to be initilized immediately or just before use in an expression? Thanks.
public class TestClass
{
static int a;
int b;
public TestClass()
{
int c;
c = a;
a++;
b += c;
}
public static void main(String args[]) { new TestClass(); }
}

Originally posted by Bob Reardon:
Does anyone know when Sun will drop the current exam (1.2) and start using the new exam (1.4)?



I heard here, that it was going to be discontinued sometime this summer.