Last active
October 9, 2020 21:29
-
-
Save donchan922/e885728efcfeaacd6ccc28ef7beddeb1 to your computer and use it in GitHub Desktop.
【Java】lengthとlength()の違い
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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