Getting replies for Java programming questions and observations in the online COMP268 forum seems to be an issue. One student quoted a popular song, "Is there anybody out there?". Where is the author, for example, of the online Study Guide? Or was it assembled robotically?
Here's a question, among others we've asked, relating to Java programming and the online Study Guide, so far without any replies or attention whatsoever (2014 03 16):
Online Study Guide Unit 1 A Quick Introduction to String Objects and String Methods:
This animation highlights string objects and methods used by string objects. Here we deal with two string objects and a number of string methods that are employed on these two objects.
To start the animation [a flash animation, depicted in the pic below], first type in two strings. These two strings correspond to two String class objects named string1 and string2. They can be identical or different. When you press Start, a two-column table will be displayed.
However, selecting the string1.equals(string2) method for null on both strings yields "true" in this [Study Guide] flash animation.
But apparently invoking an equals() on a null gives a NullPointerException,
if you invoke
.equals()
onnull
you will getNullPointerException
So it is always advisble to check nullity before invoking method where ever it applies
answered Dec 21 '10 at 15:49 Jigar Joshi
and,
In Java 0 or null are simple types and not objects.
answered Dec 21 '10 at 15:55 user523859
http://stackoverflow.com/questions/4501061/java-null-check-why-use-instead-of-equals
The Java API for equals() states that,
The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values [my bolding] x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).
http://download.java.net/jdk8/docs/api/java/lang/Object.html#equals-java.lang.Object-
One Java apparent professional has stated that the equals() method is broken in Java, and recommends using another library completely:
http://functionaljava.googlecode.com/svn/artifacts/3.0/javadoc/fj/Equal.html
Note: because this forum (The Landing) only links to image urls, I am uploading my pic of the online study guide for COMP268 elsewhere, and then linking to it.
The Landing is a social site for Athabasca University staff, students and invited guests. It is a space where they can share, communicate and connect with anyone or everyone.
Unless you are logged in, you will only be able to see the fraction of posts on the site that have been made public. Right now you are not logged in.
If you have an Athabasca University login ID, use your standard username and password to access this site.
We welcome comments on public posts from members of the public. Please note, however, that all comments made on public posts must be moderated by their owners before they become visible on the site. The owner of the post (and no one else) has to do that.
If you want the full range of features and you have a login ID, log in using the links at the top of the page or at https://landing.athabascau.ca/login (logins are secure and encrypted)
Posts made here are the responsibility of their owners and may not reflect the views of Athabasca University.