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 (5)

1 answer

Last reply by: Maury Hillstrom
Wed Jan 1, 2014 5:38 PM

Post by Dionisis Mastavralis on December 31, 2013


I haven't understand when you are using "public static void main(String[] args)" and when "public static void main(String args[])" ?

0 answers

Post by Phil Wyder on March 19, 2013

I have trouble running example 4 in netbeans. It always tells me that the main class is not found. If I try to run it in Terminal, I get the following error.

Main method not found in class triangle, please define the main method as:
public static void main(String[] args)

I blindly copied your text and tried to make it work. When I just add "public static void main(String[] args)" it also doesn't work. How can I make it work?

0 answers

Post by Phil Wyder on March 19, 2013

You may change the lecture slide "Boolean Logical Operators" and switch the y value back to 2. The very similar tables could be confusing who do not realize that the y value changed from 2 to 3. (Which isn't necessary anyway.) I think changing the example (x==2||y==2) to (x==3||y==3).

0 answers

Post by Gregory Gauthier on January 20, 2013

Aloha, I am trying like the devil to do a practice exercise from my book:
But I would really appreciate seeing the code so I can grasp my errors and stop spending hours going in circles:
Here it is:

Write a program that allows the user to convert a temperature given in degrees from either Celsius to Fahrenheit or Fahrenheit to Celsius. Use the following formulas:

Degrees_C = 5(Degrees_F- 32)/9
Degrees_F = (9(Degrees_C)/5) + 32)

Prompt the user to enter a temperature and either a C or c for Celsius or an F or f for Fahrenheit. Convert the temperature to Fahrenheit if Celsius is entered, or to Celsius if Fahrenheit is entered. Display the result in a readable format. If anything other that C,c,F, or f is entered, print an error message and stop.

If Logic

  • “If” statements allow a program to make a decision
  • “If” statements require “yes or no” type questions
  • “If” statements take a desired action based on the answer to that question
  • Java “if” statements follow “If...Else...” logic

If Logic

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
  • The Mighty 'If' 0:08
    • If Logic and If Statements
  • Conditional Statements in Java 1:44
    • If
    • If…Else
    • If…Else If….Else
    • Switch
  • Pseudocode 3:41
    • Pseudocode
    • Examples
  • Compound Assignment Operators 6:17
    • Compound Assignment Operators and Examples
  • Boolean Logical Operators 9:02
    • && Operator
    • | | Operator
    • ! Operator
  • Example 1: Program that Determines the Larger of Two Numbers 13:00
  • Example 2: Determine the Largest and Smallest Entry 15:55
  • Example 3: Determine if a Number is Odd or Even 19:24
  • Example 4: Determine if Three Values Could Form a Triangle 21:44
  • Example 5: Run Application for Triangle 24:23
  • Example 6: Basic If…Else Statement 25:11
  • Example 7: Basic If…Else If…Else Statement 26:52
  • Example 8: Catch Possibilities if User Enters Invalid Numbers 28:38
  • Example 9: Basic Switch Statement 31:10