Java, Spring 🌱

아래와 같은 엑셀 파일에서 회차, 당첨번호만 골라내 출력해보자import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import jxl.Cell;import jxl.Workbook;import jxl.read.biff.BiffException;import jxl.Sheet;public class LottoEx01 { public static void main(String[] args) { // TODO Auto-generated method stub Workbook workBook = null; try { workBook = workBook.getWorkbook(new FileInp..
아래 사이트 접속https://jexcelapi.sourceforge.net/ JExcelApi    Java Excel API is a mature, open source java API enabling developers to read, write, and modifiy Excel spreadsheets dynamically. Now java developers can read Excel spreadsheets, modify them with a convenient and simple API, and write the changes to ajexcelapi.sourceforge.netFiles 클릭jexcelapi 클릭2.6.12 클릭 jexcelapi_2_6_12.zip 클릭다운받은 jxcelapi..
아래와 같이 인자값을 받으면 그에 맞는 구구단을 출력하는 파일을 생성하는 프로그램을 짜보자java Gugudan 3단import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;public class Gugudan { public static void main(String[] args) { // TODO Auto-generated method stub FileOutputStream fos = null; try { fos = new FileOutputStream("./" + args[0] + ".txt"); int dan = Integer.parseInt(args[0].r..
import java.util.Calendar;public class CalendarEx04 { public static void main(String[] args) { // TODO Auto-generated method stub // 현재달의 달력 int year = 2024; int month = 5; // 달력 출력 Calendar startCalendar = Calendar.getInstance(); Calendar endCalendar = Calendar.getInstance(); startCalendar.set(year, month-1, 1); endCalendar.set(year, month, 1-1); int startDayOfWeek = startCale..
1. 먼저 아래 페이지에 접속 뒤 Download라고 적힌 주황색 버튼 누르기https://www.eclipse.org/ The Community for Open Collaboration and Innovation | The Eclipse FoundationThe Eclipse Foundation provides our global community of individuals and organisations with a mature, scalable, and business-friendly environment for open source …www.eclipse.org 2. 아래 페이지에서 Download Packages 클릭 3. java를 이용해 웹을 만들것이기 때문에 Eclise IDE for En..
먼저 Visual studio에서 아래와 같은 HelloWorld.java파일을 만든다public class HelloWorld { public static void main(String[] args) { // 프로그램 시작 // 연결해서 출력 System.out.print("Hello"); System.out.print("안녕"); System.out.println("Hello"); System.out.println("안녕"); // %n \n - 엔터키, \t 탭키 System.out.printf("[%s]%n", "Hello"); System.out.printf("[%..
char배열을 String클래스로 변환하거나, 또는 그 반대로 변환해야 하는 경우, 아래의 코드를 사용하자 char[] chArr = {'A', 'B', 'C'}; String str = new String(chArr); // char배열 -> String char[] tmp = str.toCharArray(); // String -> char배열
char 배열을 문자열로 변환하는 방법에는 여러 가지가 있습니다. 여기에는 몇 가지 일반적인 방법이 포함됩니다 1. String 생성자 사용: String 클래스의 생성자 중 하나는 char 배열을 받아들일 수 있습니다. char[] charArray = {'H', 'e', 'l', 'l', 'o'}; String str = new String(charArray); System.out.println(str); // 출력: Hello 2. String의 valueOf() 메서드 사용: String 클래스의 valueOf() 메서드를 사용하여 char 배열을 문자열로 변환할 수도 있습니다. char[] charArray = {'H', 'e', 'l', 'l', 'o'}; String str = String...
1. String.join()메서드 사용하기 String.join() 메서드는 Java 8부터 도입되었으며, 배열의 모든 요소를 지정된 구분자로 연결하여 하나의 문자열로 반환합니다. String[] array = {"apple", "banana", "grape"}; String result = String.join(", ", array); System.out.println(result); // 출력: apple, banana, grape 2. new String() 생성자 활용 new String() 생성자의 매개변수로 문자열 배열을 전달할 수 있습니다. 이렇게 하면 문자열 배열의 내용을 결합하여 새로운 문자열을 생성합니다. 예를 들어: String[] words = {"Hello", "world", "..
length 속성은 Java에서 배열과 문자열의 길이를 나타냅니다. 배열: 배열의 길이는 배열에 저장된 요소의 개수입니다. 문자열: 문자열의 길이는 문자열에 포함된 문자의 개수입니다. 예를 들어: int[] numbers = {1, 2, 3, 4, 5}; System.out.println("Length of numbers array: " + numbers.length); // 출력: Length of numbers array: 5 String str = "Hello, world!"; System.out.println("Length of str string: " + str.length()); // 출력: Length of str string: 13 위의 코드에서 numbers.length는 배열 numbe..
korinj
'Java, Spring 🌱' 카테고리의 글 목록 (2 Page)