Exception in thread “main” java.util.IllegalFormatConversionException: d != java.lang.String

后端 未结 3 1586
深忆病人
深忆病人 2020-11-28 00:15

I\'m new to Java and I\'m not sure how to fix the error I\'m getting when trying to run this code:

import java.util.Scanner;
public class P3_3 
{

    publi         


        
3条回答
  •  心在旅途
    2020-11-28 00:39

    Change your last printf to:

    System.out.printf("number has %d digits ", number);
    

    Try to append all the string together and use specifier i.e.

    System.out.printf("blah %d blah ", value).
    

提交回复
热议问题