Variable Type - String

String pageTitle = ("variablesTutorial");
detailed video instructions can be found at the bottom of the page

Programming can be pretty hard to start out in. But if you take it slow and try to learn a little at a time, you'll find yourself grasping complicated concepts! The first thing every programmer needs to learn is Variables.

Variables are a way to tell the program how to use data.

Let's pretend you need your program to record your name!
This is when you need a variable.
Your name will be stored as a variable, to do this, your code would look something like:

String yourName = ("Taylor");


In this example, I told the program that I needed a variable, and I named the variable yourName.
When I typed String, then, with the ("Taylor"); input, I told them that the variable yourName's value would be Taylor. Now you can have it reference the yourName variable from anywhere in your code and it will treat it as Taylor.

With this, you can now have it reference that data. Try doing a system.out.print with your new variable using the following steps:

Specific Instructions:



Step 1: You must create the application form. Do this by clicking, File -> New Project ->  Finish.

Step 2:  Type the following code one line below  public static void main(String[] args) {

String yourName = ("Taylor");
System.out.println("Your name is " +yourName);

Step 3: Hit F6. You should have no errors and it should display Your name is Taylor in your output window.
I also made a video that covers different types of ints and how to declare them in the following video:
DETAILED VIDEO BELOW



4 comments: