मैं यह निर्धारित करने की कोशिश कर रहा हूं कि मैं क्या गलत कर रहा हूं यह निर्धारित करने के लिए जावा पाठ्यपुस्तक को खराब कर रहा हूं।जावा शुरुआती: प्रतीक नहीं मिला
System.out.println("The three initials are " +
getInitials(Harry, Joseph, Hacker));
निर्देश कोड में टिप्पणी की: त्रुटि मैं वापस हो रही है लाइन 13 पर "प्रतीक नहीं खोजा जा सका" है, जो कोड के साथ लाइन है। मुझे पूरा यकीन है कि इसे मेरे द्वारा स्थापित नामों के साथ करना है .. लेकिन मुझे यकीन नहीं है।
public class InitialsTest {
/**
Gets the initials of this name
@params first, middle, and last names
@return a string consisting of the first character of the first, middle,
and last name
*/
public static void main(String[] args) {
System.out.println("The three initials are " +
getInitials(Harry, Joseph, Hacker));
}
public static String getInitials(String one, String two, String three) {
String initials = one.substring(0,1) + two.substring(0,1) + three.substring(0,1);
return initials;
}
}
charAt फ़ंक्शन का उपयोग (] के बजाय नहीं करना चाहिए? एक की तरह .charAt (0) + two.charAt (0) + three.charAt (0) –
हाँ क्षमा करें मेरा बुरा :) – Anusha