इस कोड में त्रुटि कहां है? नेटबीन्स आईडीई 8.2 आरसी के लिए जावा [डुप्लिकेट]
Dec 09 2020
यहाँ समस्या कहाँ है
public static void displaySum(int x , int y) {
System.out.println("Sum of %d and %d is %d ",x,y,x+y);
}
/ * ----- * /
public static int dispalySum(int x , int y ){
System.out.println("First number is %.2f \n" + x );
System.out.println("Second number is %.2f \n" + y );
System.out.println("Sum is %.2f \n" + x+y );
return x+y;
}
/ -------------- /
public static void main(String[] args){
int num1 = 3;
int num2 = 2;
displaySum(num1,num2);
}
}
आयात java.util.Scanner;
पब्लिक क्लास टेस्टी {
public static void main(String[] args) {
// मैं यहां क्या कर सकता हूं?
UcakRezervasyonSistemi thyRezervasyonSistemi = new UcakRezervasyonSistemi(5);
/ * ? /
Scanner input = new Scanner(System.in);
String inputKey = "c";
while(inputKey.equals("c" )|| inputKey.equals("C")){
thyRezervasyonSistemi.rezervasyonAl();
System.out.println("\nDevam etmek için c'ye, çıkmak için herhangi başka bir tuşa basınız ");
inputKey = input.next();
}
}
}
जवाब
Muhamamaduzair Dec 09 2020 at 02:57
आप int data type फंक्शन लिखने के लिए गलत तरीके का उपयोग कर सकते हैं। उपयोग: प्रिंट (डिस्प्लेसम (संख्या 1, संख्या 2));
PetrFořtFru-Fru Dec 09 2020 at 03:08
System.out.println()
विधि स्वरूपण का समर्थन नहीं करता। निम्नलिखित का प्रयास करें:
public static void displaySum(int x , int y)
{
System.out.printf("Sum of %d and %d is %d ",x,y,x+y);
}
या भी:
public static void displaySum(int x , int y)
{
System.out.format("Sum of %d and %d is %d ",x,y,x+y);
}