This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.



Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiler thinks my integer is an String?  RSS feed

 
Carl Pettersson
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get this error:
"Lab1.java": incompatible types;found : java.lang.String,required: int at line 96, column 54
Line 96 contains this code:
ChosenPersons[(c / 2)] = Persons.substring(c/*This is column 54*/, (c + 1));
c is declared as an int and is treated as an int everywhere else it is used. Replacing c with an "real" integer, such as 1 doesn't work either, and generates the same error, so I wonder where I am using substring wrong?
/Edit:
I am using Borland JBuilder 9
[ September 09, 2003: Message edited by: Carl Pettersson ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carl,
Welcome to JavaRanch!
I can't tell what's wrong based just on this one line of code; maybe we could see all of Lab1.java ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!