The moose likes Beginning Java and the fly likes Compiler thinks my integer is an String? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiler thinks my integer is an String?" Watch "Compiler thinks my integer is an String?" New topic

Compiler thinks my integer is an String?

Carl Pettersson
Ranch Hand

Joined: Sep 09, 2003
Posts: 73
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?
I am using Borland JBuilder 9
[ September 09, 2003: Message edited by: Carl Pettersson ]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

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 ?

[Jess in Action][AskingGoodQuestions]
subject: Compiler thinks my integer is an String?
Similar Threads
Java DB Error
type conversion
Using a class method of an object stored in a TreeMap
How to Upgrade GWT 2.0.4 to GWT 2.2.0
Oracle Stored Procedure Problem