본문 바로가기

Java 배우기145

Converting Between Numbers and Strings 숫자와 문자 사이의 변환 숫자와 문자 사이의 변환 Converting Between Numbers and Strings문자를 숫자로 변환하기 Converting Strings to Numbers 빈번하게, 프로그램은 문자열 객체 안의 숫자 데이터로 끝나는데, 예를 들명 사용자가 입력 한 값으로 끝납니다.원시 숫자 타입(Byte, Integer, Double, Float, Long 및 Short)을 둘러싼 서브클래스 Number들은 문자열을 해당 타입의 객체로 변화하는 valueOf 라는 이름의 클래스 메소드를 제공합니다. 객체에 문자열을 변환 클래스의 방법을 제공한다. 명령 줄에서 2개의 문자열을 얻는, 예제 ValueOfDemo는 그들을 숫자로 변환시키고, 그 값들 위에서 연산을 수행합니다:Frequently, a progra.. 2016. 1. 5.
Strings 문자열 문자열 Strings 자바 프로그래밍에서 널리 사용되는 문자열(Strings)은 일련의 글자들(characters)입니다. 자바 프로그래밍 언어에서, strings은 객체입니다. Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. 자바 플랫폼은 문자열을 생성하고 조작하기 위한 클래스 String을 제공합니다. The Java platform provides the String class to create and manipulate strings. 문자 만들기 Creating Strings string을 생성하는 가.. 2016. 1. 5.
Characters 글자 글자 Characters 대부분의 경우, 1개의 글자 값을 사용하는 경우 primitive char type을 사용할 것입니다. 예를 들면: Most of the time, if you are using a single character value, you will use the primitive char type. For example:char ch = 'a'; // Unicode for uppercase Greek omega character char uniChar = '\u03A9'; // an array of chars char[] charArray = { 'a', 'b', 'c', 'd', 'e' }; 하지만 객체로 char를 사용할 때가 있는데 - 예를 들면 객체가 예상될 때 메소드 argum.. 2016. 1. 5.
Questions and Exercises: Numbers 질문과 연습: 숫자 질문과 연습: 숫자 Questions and Exercises: Numbers질문 QuestionsUse the API documentation to find the answers to the following questions:What Integer method can you use to convert an int into a string that expresses the number in hexadecimal? For example, what method converts the integer 65 into the string "41"?What Integer method would you use to convert a string expressed in base 5 into the equivalent .. 2016. 1. 5.
Summary of Numbers 숫자의 요약 숫자의 요약 Summary of Numbers 객체 안에서 많은 원시 타입을 감싸기 위하여 wrapper 클래스들 – Byte, Double, Float, Integer, Long, 또는 Short – 중 하나를 사용합니다. 자바 컴파일러는 필요할 때 그리고 그들을 언박스 할 때 자동으로 원시들을 wraps (boxes) 합니다. You use one of the wrapper classes – Byte, Double, Float, Integer, Long, or Short – to wrap a number of primitive type in an object. The Java compiler automatically wraps (boxes) primitives for you when necessary.. 2016. 1. 5.
Beyond Basic Arithmetic 기본 산술을 넘어서 기본 산술을 넘어서 Beyond Basic Arithmetic 자바 프로그래밍 언어는 산술 연산자 +, -, *, /, %를 갖고 기본적 연산을 지원합니다.java.lang 패키지 안의 클래스 Math는 보다 앞선 수학적 계산 수행을 위한 메소드와 상수를 지원합니다.The Java programming language supports basic arithmetic with its arithmetic operators: +, -, *, /, and %. The Math class in the java.lang package provides methods and constants for doing more advanced mathematical computation. Math 클래스 안의 메소드들은 모두 s.. 2016. 1. 5.