AJ Brown

Greenhorn
+ Follow
since Mar 30, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 AJ Brown

Just going to run it on my own machine to practice...Windows 2000 Professional

Thanks!
19 years ago
I've decided to start playing around with Tomcat & am having trouble installing it. I've downloaded it & SDK and do not understand this line:

* Set an environment variable JAVA_HOME to the pathname of the directory
into which you installed the SDK release.

How do I set this up? I don't understand this at all.
19 years ago
What's a good reference for the basics of what java can do and the different aspects of java? I need to read something that explains the difference between struts and jsp and j2me for example.
19 years ago
I don't understand how you get to your answer. Where does the 2 come from if it's 0?

Thanks for the quick reply.
Can someone please explain the % part of this answer? I know that, for example, 20 % 3 would be 2 but do not understand how 2 % 3 is 2.


http://www.danchisholm.net/dec20/topic/section5/operators1.html



Question 10
class EBH002 {
static int m(int i) {
System.out.print(i + ", ");
return i;
}
public static void main(String s[]) {
m(m(1) + m(2) % m(3) * m(4));
}}


What is the result of attempting to compile and run the program?

a. Prints: 1, 2, 3, 4, 0,
b. Prints: 1, 2, 3, 4, 3,
c. Prints: 1, 2, 3, 4, 9,
d. Prints: 1, 2, 3, 4, 12,
e. Prints: 2, 3, 4, 1, 9,
f. Prints: 2, 3, 4, 1, 3,
g. Run-time error
h. Compile-time error
i. None of the above



The expression can be simplified as follows: 1 + 2 % 3 * 4 = 9. The original expression is as follows: m(m(1) + m(2) % m(3) * m(4)). Simplification step one. Evaluate each operand from left to right: m(1 + 2 % 3 * 4). Step two. Add parentheses to indicate operator precedence and associativity: m(1 + ((2 % 3) * 4). Step three. Evaluate the inner-most parentheses: m(1 + (2 * 4)). Step four. Evaluate the inner-most parentheses: m(1 + 8). The result is 9.
Since you're jsut starting out, I recommend learning Java through BlueJ and the book that goes with it...Objects First
I pre-ordered this book last night. Amazon told me that the estimated shipping date is June 29.
Question 14
public class MyProgram {
public static void throwit() {
throw new RuntimeException();
}
public static void main (String args[]){
try {
System.out.println("Hello world ");
throwit();
System.out.println("Done with try block");
}
finally{
System.out.println("Finally executing");
}
}
}
answer is "the program will print Hello world, then will print Finally executing, then will print that a RuntimeException had occurred.
Question 15
public class RTExcept {
public static void throwit() {
System.out.print("throwit ");
throw new RuntimeException();
}
public static void main(String [] args) {
try {
System.out.print("hello ");
throwit();
}
catch (Exception re) {
System.out.print("caught ");
}
finally{
System.out.print("finally ");
}
System.out.println("after ");
}
}
answer is hello throwit caught finally after
I just pre-ordered the SCWCD book and Amazon told me that the estimated shipping date is June 29.
[ April 22, 2004: Message edited by: AJ Brown ]
I'm referring to questions 14 and 15 on page 280-281 in Kathy and Bert's SCJP book.
Why does Q.14 print out that a RuntimeException has occurred while Q.15 does not? Is it because Q.14 has no catch statement?
What books do you all recommend for learning about J2ME? My only background in Java is SCJP.
19 years ago
I took the exam this afternoon and there was a spelling error in one of the words on a code piece for a question. There was no "compilation fails" option for this question. Has this happened to anyone else? Should I tell Sun about this? If so, how?
I first started to learn java last August with the bluej IDE (free) and the book that went along with it, "Objects First with Bluej". This helped me tremendously as I had tried to learn java before and gave up as I couldn't understnad it whe it was taught the traditional way. The book and bluej were the best. Then I decided to go for certification so since February, I have been studying the Bates and Sierra book. The bluej IDE and book brought me far enough where I could understand what was going on in the Bates and Sierra book. I am at the point where I probably will schedule the SCJP exam next week.
Adding the ( ) helps me understand
so the line....
if ( b1 & b2 | b2 & b3 | b2 | b1 )
should be read as
(true & false) | (false & true) | false | true
goes to next step...
false | false | false | true
so this is true then
19 years ago
Can someone please explain how to come up with this answer? It's from the Sierra and Bates book (page 199), but I still do not understand when looking at the answer explanation in the book. I guess I need someone to explain the order of evaluation of lines 6 and 8 in detail. Thanks!!
Given the following:
1. class SSBool {
2. public static void main(String [] args) {
3. boolean b1 = true;
4. boolean b2 = false;
5. boolean b3 = true;
6. if ( b1 & b2 | b2 & b3 | b2 )
7. System.out.println("ok ");
8. if ( b1 & b2 | b2 & b3 | b2 | b1 )
9. System.out.println("dokey");
10. }
11. }
19 years ago