From the course: Java 11+ Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Declare and modify primitive values

Declare and modify primitive values - Java Tutorial

From the course: Java 11+ Essential Training

Start my 1-month free trial

Declare and modify primitive values

- [Instructor] In order to test out some simple code, I'm going to use Java's JShell environment. As I mentioned previously, you can run JShell from any command line or a terminal window, but if you're using IntelliJ IDEA, you can use the terminal window there. You can use any IntelliJ IDEA project for this exercise. The goal is simply to get to this screen, and from there, click terminal and then type JShell and press Enter or Return. And that should take you to the JShell environment. I'll double-click on this bar and that expands my terminal window to more full screen. First, I'm going to declare a number of primitive values using explicit data typing. I'll start off with type b equals one and that creates a byte value. I can see that value just by typing the name of the variable and pressing Enter or Return. That's something specific to Jshell, it doesn't work in actual Java code. Next, I'll create a short integer.…

Contents