Taking a college-level programming course? Maximize your learning with these Java tutorials. Peggy Fisher explores command-level programming, basic techniques such as managing loops and creating methods, debugging Java code, working with classes and objects, and storing and sorting arrays. Along the way, she investigates the Java API and Java's capabilities for running simulations and algorithm analysis, and issues challenges to write programs that utilize all of these Java features.
Lecturer at Penn State UniversityPeggy 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
- At this point, you should already have downloaded an Integrated Development Environment., or IDE, and be familiar with using this IDE. For this series, I'm using NetBeans. But if you prefer to use Eclipse or BlueJ, which are also free interactive java development environments, that's fine, and most of the examples are easily adapted to those environments. If you need help downloading an Integrated Development Environment, please see "Up and Running with Java," on lynda.com. As you know, Java is a strict data-typing language. That is, every variable must be declared with the data type, and your program cannot change the type of data stored in that variable. For example, if you declare a variable to store numbers, you cannot try to store Strings in the same variable. You would get an error message, "Incompatible types: String cannot be converted to int." Each programming language has the same basic parts. Let's do a quick review. Comments. Comments can be single-line or multi-line. Variables include the data type and the name. Expressions, which are equations or statements. Decisions, such as "if something is true." Loops, which allow the program to repeat. Input and Output, which can be from the console or files. And Methods. Some languages refer to Methods as functions. And there are more parts, but those are the ones you want to concentrate on for now. Let's take a minute to quickly review expressions with data types. Here is an example Java program with the data types we just reviewed. On line 12 we declare a character variable called "letter," and we assign it the value capital "A." Notice the single-quotes for characters. Then we have a Boolean variable called "done," and it's set to false. Boolean variables can be true or false. We have an integer variable called "radius," and it is set to the value "10." We have a byte variable called "red." Sometimes byte variables are used to hold the saturation level of green, red, and blue when trying to create colors. In this case, I have red set to "127." A byte can be from -127, to +127, or unsigned values from 0 to 255. On line 16 we have a data type called "short." It's also an integer, but it's much smaller than an int. Short age equals 21. Sometimes you need to hold a very large integer. Then you want to use "long." And finally rational numbers, such as "float" and "double." Notice that when you declare a variable of type "float," you need to include the "f" after the number, "10.59f," and finally we have a String variable named = "Peggy Fisher." Strings are not technically a primitive data type, but since they are used so often, it is usually included when discussing primitive data types. Strings are actually variables that are stored as an array of characters. Okay, so what does it mean when I'm talking about primitive data types versus structured data types? The data types we just discussed are all primitive data types. The other type is structured, and we will discuss them more when we get to arrays, classes, and objects. Primitive data types store their values directly in memory, such as "int x = 5". In memory, x has the value 5. Structured data types, such as a String that's called "fruit" and is set to the word "Apple," creates a reference value, or the address of the location in memory where the data exists. In this case, my variable "fruit" has the address "@31eb494e." That's the hashcode for where the data is located in memory. Later we'll talk more about objects and classes, and it's helpful to know that every primitive data type has a corresponding wrapper class. This allows us to create objects that contain values, such as integers, characters, etc. For example, "int" has a corresponding wrapper class called "Integer," "double" has a corresponding class called "Double." Notice the capital "I" in "Integer" and the capital "D" in "Double," as well as the "B" in "Boolean" and the "C" in "Character," because classes always start with a capital letter. This was hopefully a review for you. If not, you might want to go back and review "Up and Running with Java."
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.