• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/53

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

53 Cards in this Set

  • Front
  • Back
List some rules one might use in programming languages.
• Keywords, and Syntax
• Statements that carry out pre-determined logic
• Variables
• Programmer-defined names
• Operators
• Data Structures
What are the two types of classes?
1. Application Class: think of this as the means by which the flow of the application is controlled
2. Classes that represent objects: Think of this as a blueprint of a type of object or “thing” that is represented in our application
What does a class include?
• A data section
• A method section
• It does NOT execute on its own
• It provides all the code to create objects with similar characteristics (attributes) and similar behaviors (actions)
Why is Java so important?
Java can be coded to run the same on all platforms. Because it runs on all platforms, JAVA is the language used to develop code for web and mobile devices.
What are the requirements for a Java Application?
It must contain a “main” method, and it may contain other java classes.
What are the two ways a Java program can be written and what are their functions?
1) An Applet – a Java program designed to run in a Web page

2) An application – a Java program designed to run anywhere
What do other classes need?
Some classes are provided in the JAVA language, but other classes you need to define yourself.
Can a Java program be composed of one or more classes?
Yes, all JAVA programs are composed of one or more JAVA classes.
What is the first step in a basic Java Application?
We always start the application class source:

public class classname
What does Public mean?
Whatever you are making public is available to other classes.
What does Static mean?
An object doesn’t need to be instantiated to use the method.
What does Void mean?
The method doesn’t return anything.
What are arguments?
Data the method or statement needs to do its job, found in parentheses.
How do you end most Java statements?
All Java statements end in a semi-colon.
What does System.out.print() do for your code?
Prints whatever is within quotes in the parentheses on one line of output.
What does System.out.println() do for your code?
Prints whatever is within quotes in the parentheses on one line of output and then puts the cursor at the start of the next line.
Where do we get System from?
From the Java API package java.lang
What is ‘out’ referred to as?
out is an attribute (often called Instance Variable) of the class.
What do print() and println() represent?
print() or println() are methods of the system class.
Why is the java.lang package so significant?
Any class from the java.lang package can just be used directly in your code without doing anything special first.
What is an escape sequence?
A backslash followed by a character that has special meaning to the compiler. They are used to complete an action when there is no other way to do it.
String literals must be enclosed in what?
Double quotes:

“String Literal”
What do we use to print two different strings and what is the name of the procedure?
We use the string concatenation operator +
What is a literal?
Any string, number, or character that can be written into a program, and that we want to program use to generate the intended result.
What is a variable?
A space in the computer’s memory that we reserve to hold specific data.
What are the specific rules that must be followed with all identifiers?
• Should have a meaningful name
• Must begin with a letter, an underscore, or a dollar sign.
• The remaining characters can be letters, digits, underscores, or dollar signs.
• Cannot contain spaces
• Case sensitive.
Can a variable hold more than one value?
A variable cannot hold more than one value at one time. If you declare a variable, the value can change, but it cannot be 2 values at once.
What is the priority of math operators?
1. ()
2. *, /, %
3. +, -
4. <, <=, >, >=
What package do we get the Math Class from?
java.lang
What is the rank of data types?
1. double
2. float
3. long
4. int
5. short
6. byte
Can we force a conversion and if we can how?
We can “force” the conversion in either direction by casting.
What are constants and how do we code them?
Constants are like variables, but their values never change. We declare them by using the final keyword:

final double MINI_BLIZZARD = 2.70
What does a class contain?
Each class has a name, attributes called instance variables, and methods.
Where can we acquire classes?
Some classes are part of the JAVA API, but others we get from JAVA libraries or we create ourselves.
What are classes considered to be?
Classes are considered to be a reference data type.
What is a reference data type?
A reference data type assigns the memory address of that String object to the variable.
What does Length do?
Provides the length of a string object.
What type of statement do we need to use classes from other packages?
We need an import statement.
Who do I request a Scanner in a program?
The Scanner class is used to get data into the program. We can use the same Scanner object for different input in our program.
What is the difference between a Class Name and *, and which one is better?
A class name says that we will use the certain class from the package. The * means that we will use multiple classes from the same package. The class name is better when using less than 3 classes. Be careful of the memory recourses when using *.
How do we create a Scanner?
Scanner keyInput = new Scanner(System.in);
What can we use to get the data from the Scanner to the variable? Name a few.
Scanner Methods:
nextByte()
nextDouble()
nextFloat()
nextInt()
nextLine()
nextLong()
next Short()
Is there a difference for a Char versus a String?
Yes, to allow a char you need to do something like this:
String gradeAsString;
char grade;
gradeAsString = keyInput.nextLine();
grade = keyInput.charAt(0);
Should we accept a String or a number first?
Try to accept a string first, but if you need to accept the number first, remember to run an extra “nextLine()” method between the number and the string.
What is a different way to read information (not Scanner)?
JOptionPane
How do I request a JOptionPane?
import javax.swing.JOptionPane;
Name two Dialog boxes that you can use.
Message Dialog
Input Dialog
How do I code a Message Dialog Box?
JOptionPane.showMessageDialog(null, ”Phrase”)
Why do I need a null?
Null is the default argument used when you are displaying contents in different windows.
Is there a catch to using a Dialog box?
It only returns the user input as a string.
As a programmer how do I get around the Dialog Box catch?
Convert To String Using:
Byte.parseByte(string Variable)
Double.parseDouble(string Variable)
Float.parseFloat(string Variable)
Integer.parseInteger(string Variable)
Long.parseLong(string Variable)
Short.parseShort(string Variable)
What does Decimal Format do?
One way to format floats and doubles.
What is the preferred way to code an output with decimals?
Printf method