Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34859
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Scanner error |
| Date | Mon, 11 Jul 2016 15:26:15 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 25 |
| Message-ID | <nm0rsq$8am$2@dont-email.me> (permalink) |
| References | <87b76adc-9800-410f-ac5a-3cd25588bb3a@googlegroups.com> <charAt-20160711202259@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Mon, 11 Jul 2016 19:26:18 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="e905b254ff7ab0d0dda2c4195925adb8"; logging-data="8534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/k6oeNA9xDlC4oX8TvKA4" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
| In-Reply-To | <charAt-20160711202259@ram.dialup.fu-berlin.de> |
| Cancel-Lock | sha1:6SGVBP35tkLysIi5n63XB1pohx4= |
| Xref | csiph.com comp.lang.java.programmer:34859 |
Show key headers only | 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
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