Contact Us Sitemap
Main Menu
Learning Greek
- - - - - - -
- - - - - - -
More Articles
- - - - - - -
CafePress Designs
- - - - - - -
Free Downloads
Web Links
Paypal Donate
Subscribe to RSS
RSS Feed
Who's Online
Visitors: 3130347
Login Form

Lost Password?
Blog Directory & Search engine
Home arrow Java arrow Studying for the Java Programmer certification

Warning: Call-time pass-by-reference has been deprecated in /home/content/m/i/k/mikenoel/html/mambots/content/joscomment.php on line 43
Studying for the Java Programmer certification Print
Written by Mike Noel   
Thursday, 11 August 2005
Page 1 of 4
I have started studying to take the Sun Java Programmer certification exam. This 2 hour written exam covers, in excrutiating detail, the core elements of the Java programming language. This exam doesn't focus as much on the Java libraries. That is saved for the Sun Java Developer certification. To prepare for the exam I am working my way through A Programmer's Guide to Java Certification (2nd edition), by Khalid A. Mughal and Rolf W. Rasmussen. This book comes highly recommended from the reviews on
Although I am not new to Java (I taught college computer science classes using Java and have spent over a year developing a complex Java application) I have chosen to study for the exam using this book because I'm certain there are details of the Java language that I don't know about. This article will serve as a blog of sorts that I keep updated while I work my way through the Khalid book. It is my hope that others who are preparing for the exam can find some useful information here.

The article follows the same chapters as the Khalid book but keep in mind that it is not a replacement for the book. Most of the material that the book covers is not mentioned in this article. The point of this article is to focus on some of the more unusual details of Java so the fundamentals are skipped over.

Chapter 1: Basics of Java Programming

More comments on this chapter will be added later.

Chapter 2: Language Fundamentals

More comments on this chapter will be added later.

Chapter 3: Operators and Assignments

This chapter covers the Java operators. This includes all of the arithmetic, comparison, relational, equality, bitwise operators as well as a few special operators (instanceof and []). It also covers the equals() method and parameter passing.

The & and | operators

The operators & and | have a different meaning in java for boolean operands. In other programming languages I'm used to these operators being bitwise AND and OR. That's still the case in Java as long as the operands are integral. For boolean operands these operators act the same as && and || but don't do short-circuiting. That's interesting but I don't know what the application would be. Why would you want to avoid short-circuiting in an expression?

Operand evaluation order

All the operands of an arithmetic expression statement are evaluated, left-to-right, before the expression itself is evaluated. The order of the evaluation of the operands is not controlled by the precedence of the operators or added parentheses. For instance, in the statement:
  int x = f1() + f2() * f2(); 
The functions f1(), f2(), f3() will be called in that order even though the multiplication of the result from f2() and f3() will happen first. Other programming languages (notabely, C and C++) do not define the order of evaluation of the operands. In fact, it is compiler dependant. Some compilers would give you the 1,2,3 order while others would give you the 2,3,1 order.
There does seem to be some confusion about the operand evaluation order and the increment/decrement. And example in Khalid on page 64 says:
  long i=10; long k= i++ + i--; // (1)
Based on the "all operands are evaluated first" rule I would expect line (1) to become: long k = (10)++ + (10)--; That is, the "i" in the statement is given it's value in all cases before any of the arithmetic operators are applied. Since the operators are increment/decrement operators then obviously they operate on the variable "i" itself so the substitution of "10" in that example is to illustrate what I thought should happen for evaluation. But I'm missing somethere here. The result of this statement is that k hold the value 21 while i holds the value 10. I'm not sure why it is this way.

<< and <<<

Java has two right-shift operators: << and <<<. The first operator does sign-extended shifting while the second operator always fills the left-most bits with 0. Since negative values are stored as twos compliment using the <<< operator on a negative value will change it to a positive value (not the positive version of the number though).

Last Updated ( Tuesday, 11 July 2006 )

Copyright 2004 - 2008 Mike Noel. All rights reserved.
This Site is powered by Joomla!.