JShell is an interactive tool (REPL) introduced in Java 9. We can execute snippets like expressions, variables, methods, classes, and etc without a main () method in the JShell tool.
We can execute any prior snippet by simply typing /id, which indicates the snippet’s ID. For instance, if we type "/1", then JShell can display the first snippet that we have entered, executes it, and shows the result. We can re-execute the last snippet that we have entered (whether it is valid or invalid) by using "/!".
In the below code snippet, we have created a set of snippets, and execute those snippets by using /1, /2, /3, and /4.
<strong>C:\Users\User>jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> 2+10 $1 ==> 12 jshell> String s = "Tutorialspoint" s ==> "Tutorialspoint" jshell> System.out.println("Tutorialspoint") Tutorialspoint jshell> int num1 = 25 num1 ==> 25 jshell> /1 2+10 $5 ==> 12 jshell> /2 String s = "Tutorialspoint"; s ==> "Tutorialspoint" jshell> /3 System.out.println("Tutorialspoint") Tutorialspoint jshell> /4 int num1 = 25; num1 ==> 25</strong>
在下面的代码段中,我们可以使用"/!"命令重新执行上一个代码段。
<strong>jshell> 2+5 $1 ==> 7 jshell> 10-6 $2 ==> 4 jshell> /1 2+5 $3 ==> 7 jshell> /! 2+5 $4 ==> 7</strong>
위 내용은 Java 9의 JShell에서 ID별로 코드 조각을 어떻게 실행할 수 있나요?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

이 기사에서는 Java 프로젝트 관리, 구축 자동화 및 종속성 해상도에 Maven 및 Gradle을 사용하여 접근 방식과 최적화 전략을 비교합니다.

이 기사에서는 Maven 및 Gradle과 같은 도구를 사용하여 적절한 버전 및 종속성 관리로 사용자 정의 Java 라이브러리 (JAR Files)를 작성하고 사용하는 것에 대해 설명합니다.

이 기사는 카페인 및 구아바 캐시를 사용하여 자바에서 다단계 캐싱을 구현하여 응용 프로그램 성능을 향상시키는 것에 대해 설명합니다. 구성 및 퇴거 정책 관리 Best Pra와 함께 설정, 통합 및 성능 이점을 다룹니다.

이 기사는 캐싱 및 게으른 하중과 같은 고급 기능을 사용하여 객체 관계 매핑에 JPA를 사용하는 것에 대해 설명합니다. 잠재적 인 함정을 강조하면서 성능을 최적화하기위한 설정, 엔티티 매핑 및 모범 사례를 다룹니다. [159 문자]

Java의 클래스 로딩에는 부트 스트랩, 확장 및 응용 프로그램 클래스 로더가있는 계층 적 시스템을 사용하여 클래스로드, 링크 및 초기화 클래스가 포함됩니다. 학부모 위임 모델은 핵심 클래스가 먼저로드되어 사용자 정의 클래스 LOA에 영향을 미치도록합니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

WebStorm Mac 버전
유용한 JavaScript 개발 도구
