🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18734

Re: Printing Arrays!!

#18734
From: David Orriss Jr.
Date: Thu, 07 May 1998 00:00
75 lines
2208 bytes
Well, first of all, you have an OBOB in your program (Off By One Bug).
The line that reads:

for (int i = 0; i < roc.length(); i++)

Needs to say

for (int i = 0; i <= roc.length(); i++)

Next, be sure your CLASSPATH reads something like:

CLASSPATH=.;x:JDK\LIB

Note the period '.' for the first entry in the path.  This makes sure
that the Java runtime looks in the directory you're in as well as the
JDK library directory for class information.

Hope this helps!

"Rob C" <rocker@netline.net.au> wrote:

>Hi All
>
>I'm hoping someone can tell me what I'm doing wrong?
>
>__________________________________________
>
>class PrintString  {
>  public static void main(String args[]) {
>
>  String roc = "Rocker";
>
>  for (int i = 0; i < roc.length(); i++)
>    System.out.println(roc.substring( 0, i));
>  }
>}
>__________________________________________
>
>with the desired effect bellow being printed to the
>Execuion Log
>
>R
>Ro
>Roc
>Rock
>Rocke
>Rocker
>
>I keep getting this error
>
>Error: (0) initialization error: neither class nor source found for
>java.lang.Odject
>
>I tried to import that the above class, still get the wrong error. I'm
>working through
>the examples in "Borland Learn Java In 14 Days" and I was just trying to
>experiment
>with the Arrays and Conditional Loops.
>
>am I breaking any assignment laws for the "roc" variable???
>
>thanx in Advance
>
>Rob
>
>
>

--
 David Orriss Jr. *TeamB*
 http://www.davenet.net/

 Any opinions expressed here are solely my own.  Borland may own them,
 since it's their news server, but that doesn't mean they agree with them.
Technical Details
Message-ID: <355288a8.2282101@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6itei3$u01@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,4c54a2bc3cc4521f,start
X-Google-Attributes: gidf74b3,public
From: davidorrissjr@hotmail.com (David Orriss Jr.)
Subject: Re: Printing Arrays!!
Date: 1998/05/07
Message-ID: <355288a8.2282101@forums.borland.com>
X-Deja-AN: 351327895
Content-Transfer-Encoding: 7bit
References: <6itei3$u01@forums.borland.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: David Orriss Consulting Svcs.
Newsgroups: borland.public.jbuilder.java.language