Home>
I get the error statement "Error: Incompatible type: String [] cannot be converted to String" at retur Con ;, but I don't know the cause.
public static String findtest (SQLiteDatabase db, int id) {
String sql = "SELECT name age FROM test WHERE _id =" + id;
Cursor cursor = db.rawQuery (sql, null);
String Con [] = new Con [1];
while (cursor.moveToNext ()) {
int cul1 = cursor.getColumnIndex ("name");
int cul2 = cursor.getColumnIndex ("age");
Con [0] = cursor.getString (cul1);
Con [1] = cursor.getString (cul2);
}
return Con;
}
-
Answer # 1
-
Answer # 2
String Con [] = new Con [1];
In the first place, this line should cause an error.
I don't know who the Con on the right side is, but since String is a final class and cannot be inherited, it should be impossible to insert an array of a different class called Con.
In other words, "symbol not found" or "incompatible type" should appear in this place, so the premise of the question is strange.
Related articles
- java - unable to resolve jsp file error in maven project
- i want to fix the error in the c # calculator convert part
- "sqlite3operationalerror: unable to open database file" error in python
- i want to convert an int type array to a str type array in java
- java - it is a program that uses caesar cipher to convert ciphertext to decryption in lowercase alphabets
- ruby - [rails] unable to resolve "name error in affiliates controller # show" error
- fighting ice execution error [java]
- java - an error occurs when executing the jar file
- postgresql - unable to resolve error in db: create
- java - i want to get the entire list from the db and display it, but an error occurs when executing the application
- java - web-app shows error in webxml
- java bigdecimal acceleration error when dividing by 0
- java - an error occurred when running with junit assertequals
- java - i want to eliminate the springboot error
- java - i want to get a 404 error when entering a random url in spring boot
- java - i want to display the corresponding argument in the error message when the command argument is not an integer
- i want to resolve a java error
- when i run /gradlew eclipse, i get an error if compilejava --release is an invalid flag
- i'm getting a java compile error "no class, interface or enum", but i think the parentheses are supported
Related questions
- java : It's not always possible to load data from Firebase
- java : Creating an object that depends on an object from another activity
- java : AAPT error: error: attribute android: hintTextColor not found
- java : How to update Recycler view with data from another thread?
- java : Animating the appearance /disappearance of items in the RecyclerView
- Tab content disappears after fragment reload (Android Studio Java)
- java : What is outerClass.get ()? .Tv_receive?
- java : SharedPreferences for persistence
- java : XML markup in Android application
- android : I want to always display a camera preview on the Surface View
The cause is that the array of String is returned even though the return value is String.