Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34859

Re: Scanner error

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Scanner error
Date 2016-07-11 15:26 -0400
Organization A noiseless patient Spider
Message-ID <nm0rsq$8am$2@dont-email.me> (permalink)
References <87b76adc-9800-410f-ac5a-3cd25588bb3a@googlegroups.com> <charAt-20160711202259@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 7/11/2016 3:23 PM, Stefan Ram wrote:
> kalisha malama <malamakalisha@gmail.com> writes:
>> How old are you ?21
>> Do you have a Coupon?(Y/N)Exception in thread "main" java.lang.NullPointerException
>> 	at Apples.main(Apples.java:15)
>
>   The method declaration
>
> void f( final java.lang.CharSequence s ){ s.charAt( 0 ); }
>
>   assumes that »s« is not null, otherwise there will be an exception,
>   which is a kind of runtime error.
>
>   The code could be replaced by, for example,
>
> void f( final java.lang.CharSequence s ){ if( s != null )s.charAt( 0 ); }
>
>   .

     I, too, sometimes type faster than I think.  Will you post a
correction?

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Scanner error kalisha malama <malamakalisha@gmail.com> - 2016-07-11 12:00 -0700
  Re: Scanner error Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-11 15:22 -0400
  Re: Scanner error Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-11 15:26 -0400
    Re: Scanner error Lew <lewbloch@gmail.com> - 2016-07-11 13:12 -0700
  Re: Scanner error Eric Douglas <e.d.programmer@gmail.com> - 2016-07-11 13:58 -0700

csiph-web