chapter 1 Flashcards
What is Computer Program
Set of instructions that tell pc what to do
What is machience language
most basic circutry level language
low level programming language
What is high level language
programming language with reasonable vocab and terms
What is syntax
A specific set of rules for the language
program statement
Similar to English sentences
Commands to carry out program tasks
Compiler or interpreter
Translates language statements into machine code
Syntax error
Misuse of language rules
A misspelled programming language word
Debugging
Freeing program of all errors
Logic errors
Also called semantic errors
Incorrect order or procedure
The program may run but provide inaccurate output
Procedural programming
Sets of operations executed in sequence
Variables
Named computer memory locations that hold values
Procedures
Individual operations grouped into logical units
Object-oriented programs
Create classes
-Blueprints for an object
Create objects from classes
Create applications
what applications is object oriented programming most used for
Computer simulations
Graphical user interfaces (GUIs)
-Not all object-oriented programs are written to use a GUI
what differs object oriented programming from traditional procedural programming
Polymorphism
Inheritance
Encapsulation
Class
Describes objects with common properties
A definition
An instance
Attributes
Characteristics that define an object Differentiate objects of the same class The value of attributes is an object’s state
Objects
Specific, concrete instances of a class
Method
A self-contained block of program code that carries out an action
Similar to a procedure
Encapsulation
Conceals internal values and methods from outside sources
Provides security
Keeps data and methods safe from inadvertent changes
Inheritance
An important feature of object-oriented programs
Classes share attributes and methods of existing classes but with more specific features
Helps you understand real-world objects
Polymorphism
Means “many forms”
Allows the same word to be interpreted correctly in different situations based on context
Java
Developed by Sun Microsystems
An object-oriented language
General-purpose
Advantages
-Security features
-Architecturally neutral
-Can be run on a wide variety of computers
-Does not execute instructions on the computer directly
-Runs on a hypothetical computer known as a Java Virtual Machine (JVM)
Source code
Programming statements written in high-level programming language
Development environment
A set of tools used to write programs
Bytecode
Statements saved in a file
A binary program into which the Java compiler converts source code
Java interpreter
Checks bytecode and communicates with the operating system
Executes bytecode instructions line by line within the Java Virtual Machine
WORA
Write once, run anywhere
Console applications
Support character output
Windowed applications
Menus
Toolbars
Dialog boxes
Literal string
Will appear in output exactly as entered
Written between double quotation marks
Arguments
Pieces of information passed to a method
Method
Requires information to perform its task
System class
Refers to the standard output device for a system
What are the requirments for class identifiers
Must begin with one of the following:
- Letter of the English alphabet
- Non-English letter (such as α or π)
- Underscore
- Dollar sign
- Cannot be a digit
- Cant be a reserved Java word
- cannot be true, false or null
Upper Camel casing (Pascal casing)
Each word of an identifier begins with uppercase letter
- UnderGradStudent
- InventoryItem
Access specifier
Defines how a class can be accessed
static
- A reserved keyword
- Means the method is accessible and usable even though no objects of the class exist
void
- Use in the main() method header
- Does not indicate the main() method is empty
- Indicates the main() method does not return a value when called
- Does not mean that main() doesn’t produce output
how does a java class need to be saved
- Save the class in a file with exactly the same name and .java extension
- For public classes, class name and filename must match exactly
compiling a java class
Compile the source code into bytecode
Translate the bytecode into executable statements
Using a Java interpreter
Type javac First.java
Parsing
Compiler divides source code into meaningful portions
Logic error
The syntax is correct but incorrect results were produced when executed
Run-time error
Not detected until execution
Often difficult to find and resolve
comments
non executed statements used for documenting a program or for notes to yourself and or others
Should include author, date, class’ name and its function
Java API
Also called the Java class library Provides prewritten information about Java classes