Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Java
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Bookmark and Share
Lecture Comments (29)

1 answer

Last reply by: Kitt Parker
Fri Jul 10, 2015 11:59 AM

Post by Elvis Wodi on February 18, 2015

encountered another error message on the replace exercise  on this line
String newText =text.Replace('', '-');     // motify the string. saying empty character literal. unclosed character literal. what should i do

0 answers

Post by Elvis Wodi on February 17, 2015

What are %d
and %f
? In the circle example why are we using %d
for diameter and %f
for area and circumference? What is the difference between %d
and %f.Also on the search code i tried following the steps you gave but i encountered and error message on this line (int index =0;)as it says the assigned value is never used.What that mean and how do i go about solving that problem.

1 answer

Last reply by: Jerry Liu
Sun Jun 22, 2014 10:29 PM

Post by Rita Sobiech on September 27, 2013

It isn't going to matter you are coding on a MAC and I have a PC is it?

1 answer

Last reply by: Arshin Jain
Wed Aug 27, 2014 4:09 PM

Post by Tarique Islam on July 16, 2013

I downloaded and setup netbeans (under Windows 8 OS).  It works with the simple Hello world stuff..Below is the program:

package myfirstjavaprogram;

* @author Owner
public class MyFirstJavaProgram {
int n;
    * @param args the command line arguments
   public static void main(String args[]) {
       System.out.print("Hello world!


But when I typed the "Import.util.Scanner;"  
It gives me error!  I tried it on the top, as well as within the package statement..

0 answers

Post by joseph kirksey on April 7, 2013

Is Java a good language fer beginners? i've read a little about C++ but the Syntax can be a bit overwhelming for me as a beginner.

1 answer

Last reply by: Phil Wyder
Mon Mar 18, 2013 2:57 PM

Post by Rumman Ahmed on February 17, 2013

What are %d
and %f
? In the circle example why are we using %d
for diameter and %f
for area and circumference? What is the difference between %d
and %f

0 answers

Post by Donna Parcel on February 1, 2013

Can you tell me what I'm doing wrong--I downloaded the 4 programs circle, search, find&replace, and calendar and tried to run them in JCreator, NetBeans and they won't run -- I get all kinds of errors.
Thanks Donna

0 answers

Post by anuj singh on January 20, 2013

I am getting error with the dot operator when i try to compile the calendar program on dos what can be the possible reason ?

0 answers

Post by Harlan Reece on December 30, 2012

I tried running the circle program through Netbeans with partial success. My compile was successful, but I did not see a prompt to enter data in the output window. In addition to this problem, I do not see an option to set as Main project option. Is there a preference option where I can set this. When I type enter my project name, it does not simultaneously provide a .Main extension in the Create Main Class field as it does in the video, but rather creates an extension with the exact same name as the project file. What am I doing wrong. Had absolutely no success in running program from DOS prompt. What am I doing wrong?

0 answers

Post by Patricia Edwards on November 11, 2012

in the command line
index = str.indexOf("c");

is the index of str.indexOf the same index as the variable initialized to 0 in the statement above? How does that work?

1 answer

Last reply by: Maury Hillstrom
Tue Nov 13, 2012 5:03 PM

Post by Jozsef Kovacs on October 30, 2012

Where can I find java.util.Scanner?

2 answers

Last reply by: Elizabeth Etta
Tue Nov 13, 2012 2:19 PM

Post by Dalbir singh on August 26, 2012

In Circle Geometry example: line 17, 18, 19 why use System.out.printf? why not System.out.println? and how do we know which one to use and when?

3 answers

Last reply by: Maury Hillstrom
Thu Nov 1, 2012 2:39 PM

Post by george masih on June 11, 2012

scanner sc = new scanner(;
statement is not working i am using ecllipse editor.any body call tell what is wrong with that?

1 answer

Last reply by: Loammi Pedroza
Tue Apr 16, 2013 8:36 PM

Post by Kwasi Roberts on March 29, 2012

On line 13 on the "Find and Replace" section can you explain tht whole line especially text.replace please?

0 answers

Post by Thomas James Hanrahan on September 29, 2011

Because for some reason the java.util.Calendar; causes the output to be one month behind. I guess that is why you always try to "Break" your code once its complete so you don't run into problems like this.

with +1
Today's date is;9-29-2011
Tomorrow's date will be: 9-30-2011

Without +1
Today's date is;8-29-2011
Tomorrow's date will be: 8-30-2011

2 answers

Last reply by: alina trandafir
Sat May 23, 2015 7:31 PM

Post by Alvaro Lacerda on September 7, 2011

On the 10th line of the calendar program, why do you add "+1" after the "(Calendar.MONTH)"? why that doesn't happen to the other lines "(Calendar.DATE)" and "(Calendar.YEAR)" ?


Working with Java

  • Java was developed in 1990 by Sun Microsystems
  • Java was based on C++ syntax
  • Java requires both the Java Runtime Environment (JRE) and the Java Development Kit (JDK) to be downloaded and installed from
  • Programming in Java follows a two-step process of writing code in a .java file, then compiling that code into a .class file
  • Programs often take advantage of built-in imported utility classes such as the “Scanner” class which allows user input

Working with Java

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • History of Java 0:09
    • History of Java
  • Requirements of Java 2:35
    • Free to Download & Install
    • System's Path Environment Variable
  • Java's Two-Step Process 5:48
    • Create Source File
    • Compile Source File Into Bytecode
  • Java Application Creation 7:35
    • Two Main Ways to Create Java Application
    • Other Popular Java-compatible IDE
  • Importing Classes 8:45
    • Importing Classes, Example, and Syntax
  • Arithmetic Rules of Precedence 10:02
    • PEMDAS vs. P(MDR)(AD)(Java)
  • Four More Program Examples 13:22
    • Example: Circle Geometry
    • Example: Searching Through a Text String
    • Example: Doing a Find & Replace
    • Example: Calendar Functions