Code Fix

初級incompatible types の原因と直し方 › パターン1

incompatible types の原因と直し方

型が合わない代入で出ます。

 1  public class Main {
 2      public static void main(String[] args) {
 3          _______ name = "Taiyo";
               ^
 4          System.out.println(name);
 5      }
 6  }
Main.java:3: error: incompatible types: String cannot be converted to int

空欄を埋めてビルドを通す

広告
広告スロット(未設定)

incompatible types の原因と直し方

String / int / char / double の相互変換ルールを整理します。

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)