Skip to content

Instantly share code, notes, and snippets.

@donchan922
Last active October 9, 2020 21:29
Show Gist options
  • Save donchan922/e885728efcfeaacd6ccc28ef7beddeb1 to your computer and use it in GitHub Desktop.
Save donchan922/e885728efcfeaacd6ccc28ef7beddeb1 to your computer and use it in GitHub Desktop.
【Java】lengthとlength()の違い
public class Main {
public static void main(String[] args) {
// length:配列の長さを取得する
int[] array = {1, 2, 3};
System.out.println(array.length); // 3
// length():文字列の長さを取得する
String str = "lengthの長さ";
System.out.println(str.length()); // 9
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment