• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Confuse BufferedReader type with String

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change this line
static Boolean CookiesPersistant(String str)

to this
static boolean CookiesPersistant(String str)
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
nani aman
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot. Its help.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you figure something out? What was it?
 
nani aman
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
  • Sun's Java Tutorial
  • Introduction to Computer Science using Java by Bradley Kjell
  • Introduction to Programming Using Java by David J. Eck
  • Dick Baldwin's Java Programming Tutorials
  • Interactive Programming In Java by Lynn Andrea Stein
  • Bruce Eckel's Thinking In Java
  • JavaRanch's own Campfire Stories
  • Allen B. Downey's How To Think Like A Computer Scientist
  •  
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic