Skip to Content
프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)
book

프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)

by 오현석, 딘 왐플러, 알렉스 페인
July 2016
Beginner to intermediate
776 pages
17h 26m
Korean
Hanbit Media, Inc.
Content preview from 프로그래밍 스칼라: 실용적인 스칼라 활용법을 익히는 가장 확실한 실전 바이블 (2.11.x 버전 기반)
697
모든
JVM
대안 언어 중에서, 스칼라와 자바 소스 코드 사이의 상호 운용성이 가장 매끄럽다.
이번 장은 자바로 작성한 코드와의 상호 운용성에 대한 논의부터 시작한다.
스칼라 문법은 대부분 자바 문법의 상위 집합이기 때문에, 스칼라에서 자바 코드를 호출하는
것은 아주 쉽다. 반대 방향으로 사용하기 위해서는 스칼라의 여러 특징이
JVM
명세를 만족시
키면서 어떻게 바이트 코드로 변환되는지 알아야 한다. 여기서는 몇 가지 상호 운용성 관련 문
제를 설명할 것이다.
22.1
자바에서 정의한 이름을 스칼라 코드에서 사용하기
자바의 타입, 메서드, 필드, 변수 이름 규칙은 스칼라의 규칙보다 더 제약이 심하다. 따라서
부분의 경우에는 스칼라 코드에서 자바 이름을 그대로 쓸 수 있다. 자바 타입의 인스턴스를 새
로 만들 수 있고, 자바 메서드를 호출하거나 자바 변수와 인스턴스 필드를 스칼라에서 사용할
수 있다.
예외는 자바 이름이 스칼라에서 키워드인 경우다.
2
.
7
절 ‘예약어’에서 본 것처럼, 이름을 역
작은따옴표로 ‘이스케이프’시켜야 한다. 예를 들어
match
라는 스칼라 키워드와
java
.
util
.
Scanner
(
http
://
bit
.
ly
/
10a8fgA
)
match
메서드를 생각해보자. 후자를 호출하기 위해서는
myScanner
.`
match
`
`
를 사용해야 한다. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다

스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다

이창현, 앨릭스 토머스

Publisher Resources

ISBN: 9788968482755