728x90 java2 [java] charAt(), indexOf()메소드 이용하는 프로그램 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import java.util.Scanner; public class IndexOfTest { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String s; System.out.println("문장입력 : "); s = sc.next(); int index = s.indexOf("A"); //A가 몇번째에 있는지 반환(정수형) char c = s.charAt(0); //0번째 문자를 반환(캐릭터형) if (index == -1) Syste.. 2019. 10. 25. java - Double형 배열과 출력(toString(),for-each) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import java.util.*; public class Assignment4_1 { public static void main(String[] args) { // TODO Auto-generated method stub double[] arr = {1.0, 2.0, 3.0, 4.0}; double total = 0.0; double max = 0.0; System.out.print("toString()으로 출력 : "); System.out.println(Arrays.toString(arr)); for (double value : arr) { System.out.print(value+" "); .. 2019. 10. 9. 이전 1 다음 728x90