+ 1

Find a string length error?help

import java.util.*; // Compiler version JDK 11.0.2 class Dcoder { public static void main(String args[]) { sterin str=new sachin_patel; int l= str.length(); System.out println(l); } }

27th Jul 2022, 9:54 AM
Sachin Patel
Sachin Patel - avatar
2 Respuestas
+ 6
May be it's mean : String str = new String("sachin_patel");
27th Jul 2022, 10:21 AM
Jayakrishna 🇮🇳
+ 4
sterin is probably String if sachin_patel is the class (?) there are missed () and dot after System.out import java.util.*; class Dcoder { public static void main(String args[]) { //sterin str = new sachin_patel; sterin str = new sachin_patel(); //parentheses int l = str.length(); //System.out println(l); System.out.println(l); //dot } } //hypothetic classes class sterin { String str=""; int length() { return str.length(); } } class sachin_patel extends sterin {}
27th Jul 2022, 10:13 AM
zemiak