Exploring the IDE

From the course: Learning Java 8

  • Course details

    Java is one of the top-five programming languages, and is used for websites, embedded controllers, and Android app development. This is an introduction to get you started programming with Java. Peggy Fisher introduces the basics: data types, strings, arrays, expressions, loops, and functions. She'll help you control the flow and logic of your code, and create classes using the principles of object-oriented design. Then go a bit beyond the basics and learn advanced techniques for working with arrays, manipulating files, and building graphical user interfaces (GUIs) that respond to user input. This three-hour capsule course is perfect for developers who need to get up to speed with Java fast, as well as for beginning programmers who want their first taste of this popular language.


    • Click here to view Peggy Fisher’s instructor page

      Peggy Fisher

      Content Strategist, Software Development Languages at Linkedin Learning Solutions with Lynda.com content

      • Peggy Fisher is a programmer and content manager at LinkedIn Learning.

        Peggy's main focus is application programming in Java, Arduino, and C++. She has also worked on courses in COBOL and discrete ,athematics. Previously she was a faculty member at Penn State University's College of Information Sciences and Technology. She started out as a programmer working for a large insurance company, but after 18 years she left her job as a director of information technology to pursue her true passion teaching. She earned a master's degree in math education, and went on to teach high school math and computer science in Pennsylvania. In 2012, Peggy accepted a position as an instructional designer at Penn State, and shortly thereafter began teaching Intro to Application Programming with Java. She is a strong supporter of women in STEM. As one of the few female programming teachers, she serves as a mentor to incoming female freshmen who are considering a career in programming. She was also the K–12 outreach coordinator for the college, where she scheduled, ran, and taught summer camps for middle school and high school students. In a PBS NewsHour interview, she expressed that all students should take at least one programming class either in high school or college. Peggy enjoys constantly learning and finding new and exciting ways to bring technology to life in and outside of the classroom, such as using Arduino microcontrollers or Lego Mindstorms, to help make learning hands-on and fun.

    Skills covered in this course

  • Welcome

    - The term IDE refers to the software used to write programs in an environment that supports a text editor that we'll use for writing our code, a compiler, which converts the code to machine language, or when you're talking about Java, to byte code. It usually includes a debugger and a runtime environment that's used to test your program execution. Some IDEs also offer intelligent code assistance referred to as IntelliSense. Kind of reminds me of Spell Check in Microsoft Word. An IDE is not required to program in Java. Some programmers prefer to write code in a separate text editor, compile the code using the Java C compiler, and then testing the program from the DOS prompt. For this series we will be using the NetBeans IDE, although I will give you one example of how to write a program and compile it using the DOS prompt. When we start NetBeans, it will automatically open to a start page. From this page we have the option of taking our tour, trying a sample project, reading the latest NetBeans news, or visiting the community corner. To prevent this page from always opening at startup, let's deselect the checkbox Show on Startup in the upper right corner. Now we can go ahead and close this window. To get started we want to create a new project. Go to File, New Project. Make sure the Java application is highlighted on the righthand side. Click Next. Let's name our program Demo with a capital D. We will leave the Project Location and the Project Folder to its default locations. Click Finish. On the left there will be a window containing a list of our projects. Currently, we only have the one Demo project. When we initially create a project with these default settings, NetBeans creates a project folder with several subfolders. Inside the Package folder which is, in our case, labeled demo with a little d, there's only one file called demo.java. For future reference, let's review some of the key parts of the NetBeans IDE before we take a closer look at our program. At the top is the standard menu toolbar which contains File, Edit, View, Navigate, Source, Refactor, Run, Debug, Profile, Team, Tools, Window, and Help. Take a moment to click on each item to see the contextual menus available for each option, such as Help. Right below that toolbar are some of the often-used icons. Starting from the left we have New File, New Project, Open Project, Save, Build, Clean and Build, Run, Debug, and more. Let's return our attention to the Demo program we created. Notice the tab for the Source code contains the name of the program with the extension .java. This is done automatically by the IDE. At the top of the program, you'll notice there's several gray lines. This is a comment in Java and it's indicated by using the /* and closing */. This is where we'll describe the intent of our program. The IDE also automatically adds our author name in the next set of comments. Let's change this comment to say Demo. Now in the main portion of the program, let's write a simple test program where we display a greeting to the console. You see where it says TODO code application logic here? Let's replace that line, which is also a different type of comment, a single line comment, with the command System. Notice the capital S. Remember, Java is case sensitive. Dot out. You can see how IntelliSense is prompting me each time. Dot println. As we move forward I'll usually refer to this as print line. Open parenthesis double quotes. We're going to put a message that says Hello, and welcome to up and running with Java. Anytime we use double quotes around a series of letters or numbers, it's considered a literal in Java. We'll talk more about that later. Now we can use the hammer icon, which is our Build icon. It'll check for any errors that we have in our code. Let's go ahead and click on the hammer. It appears that the hammer is done, but we want to see the output, so let's go to Window, Output. We can see, if I scroll down in the window in the bottom, the Build was successful. The hammer icon is used to build the byte code file. This is where the IDE converts the program to an object file that can be understood by the Java Virtual Machine. Next, let's click the green Run arrow. Now we can see the message is written to our output window. Hello, and welcome to up and running with Java. Again, the Build was successful. We have just written, compiled, and successfully run our very first Java program. Congratulations.

  • Practice while you learn with exercise files

    Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.

    Download the exercise files for this course. Get started with a free trial today.

  • Download courses and learn on the go

    Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.

    Watch this course anytime, anywhere. Get started with a free trial today.