Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-17-2007, 07:57 AM
Member
 
Join Date: Jul 2007
Posts: 10
Sageinquisitor is on a distinguished road
Char type for first character typed?
Im trying to find out a way to search the next character in "char" type.

For instance, if i wanted to find out a way to search the next character in "int" type, i would put out nextInt();

I want to essentially know how to do that with char, and with a character, not a number.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2007, 08:00 AM
Member
 
Join Date: Jul 2007
Posts: 10
Sageinquisitor is on a distinguished road
also, i know of findInLine(".").charAt(0), but for some reason, it's coming out as a nullpointer exception when i use it
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-17-2007, 08:14 AM
Member
 
Join Date: Jul 2007
Posts: 10
Sageinquisitor is on a distinguished road
ok, i just need to find out how to get rid of the nullpointerexception...
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-17-2007, 09:08 AM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Char type hold only one character. You can't obtain first character of a character. Why did not you try the solution i gave you in your previous thread?

Code:
String reply = myScanner.nextLine(); if (reply.charAt(0) == 'Y') hasCoupon = true; else hasCoupon = false;
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting an int value into a char kurtulas New To Java 2 02-16-2008 10:03 PM
reading text character by character bugger New To Java 2 11-09-2007 10:54 PM
Char to String in java trill New To Java 1 08-01-2007 03:42 PM
Help with, String, Char lenny New To Java 1 07-25-2007 04:58 PM
First Typed via video instruction ZAXTHEGREAT New To Java 15 07-23-2007 06:27 PM


All times are GMT +3. The time now is 10:34 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org