Could anybody explain to me why i have the incompatible type error when compile this program. inLine Variable is in String so i thought it would ok if i use inLine to send as a string to CookiesPersistant(inLine). But it perform wrror. Why?
Please help me..i blurr how to solve this. I am new in Java.
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ] [ September 22, 2004: Message edited by: Dirk Schreckmann ]
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
change this line static Boolean CookiesPersistant(String str)
to this static boolean CookiesPersistant(String str)
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
Welcome to JavaRanch, nani aman!
When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.
Concerning Michael's suggestion, depending on the version of Java you're using, you might need to do what he suggested. If you're using Java 2 v5, then it's not a concern. If you're using some earlier version of Java, then it is a concern.
If you're not sure, to determine which version you're using, run the following command.
javac -J-version
If you see version information for something less than 1.5, then using a Boolean where a boolean is required is a problem. You could go with Michael's suggestion, or make a call to the booleanValue() method of your Boolean.
The code you posted is rather incomplete. It doesn't compile, and when trying to compile it, it doesn't produce the error message you initially posted about. Fixing the code so that it does compile (by adding some brackets, a catch block, some imports, and a variable declaration) - well then it compiles and the error message you initially posted about remains unexperience by me.
Perhaps you could post a more complete code example. [ September 22, 2004: Message edited by: Dirk Schreckmann ]
I chage Boolean with boolean and my codes compile. Boolean and boolean is 2 different thing right. But i still can't figure out what the different.
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
boolean is a primitive data type. Things of this type are just data - i.e. values.
Boolean is an object data type. Things that are objects contain data (like primitives and other objects) and have behaviors (as defined by their methods).
Rather than have me try to repeat what any good introductory Java programming material should cover, let me direct you towards some good free resources: