Please enable JavaScript.
Coggle requires JavaScript to display documents.
Creating Java programs: (Basic programming terminology (Low level…
Creating Java programs:
Compile java class and correct java Syntax errors
Compiling a Java class
When using an IDE, click the compile button
When using a text editor, use a command line to execute
Compiling will produce one of the following outputs:
You receive one or more programming language error messages
You receive no error messages meaning it executed successfully
You receive a printout message
In a DOS you can change directories using the cd command
When you receive an error message it might be because:
You misspelled the filename
You are not within the correct directory or sub folder
You misspelled a command
Java has not installed properly
Correcting Syntax errors:
Error messages vary according the the compiler you use
A compile-time-error means the compiler could not translate the high level language into machine language
Compilers give as much errors and error information to help you
Sometimes a whole list of errors are caused by a single error, solving this error will fix the other errors as well
Basic programming terminology
Low level programming language
High level programming language
Machine code
Syntax errors
Machine language
Keywords
Logic
Program statements
System Software
Commands
Application software
Compiler
Software
Executing
Hardware
Bugs
Computer program
Debugging
Logic errors
Features of java language
It is architecturally neutral
Less work for programmers because of neutrality
Runs on a virtual machine
Simpler to use than most other object oriented languages
Used for general purpose business applications and interactive web-applications
Run java application and correct logical errors
Modifying a compiled Java Class
B)Change the existing literal string
Add a new output statement
A)Modify the text file with existing class
Before the new source code can execute you must:
Save the file with new changes
Recompile the class
Interpret the new class byte-code and execute the class
Correcting Logical errors
More difficult to find than Syntax errors
Compiler does not find spelling errors within a literal string
Logical errors must be found and resolved by a person carefully examining the program output
A logic error is a type of Run-time error
add comments to java class
Block comments
Javadoc comments
Line comments
procedural and object oriented programming
Procedural
Named memory locations are called variables
Individual operations are grouped into local units called procedures
Operations are executed in sequence
Procedures are being called
Object oriented
Used for simulations and GUI's
Understand:
Encapsulation
It is the enclosure of data and methods within an object
Inheritance
The ability to create classes that share attributes and methods of existing classes.
Polymorphism
Different ways to describe the same thing
Involves
Creating classes
Creating objects
Creating applications
A class describes a group of objects
Extension of procedural programming
An object is a specific instance of a class
Analyse a java application that produces console output
Understanding the first class
everything between curly braces is the class body
"First" is the name of the class
public is an access specifier
The keyword"Class" identifies First as a class
Understanding the Main() method
void is the methods return type
args is the identifier of the array of Strings that is the argument to this method
Static means this method works without instantiating an object of the class
String is a class, any argument within must be a string
Square brackets means the argument to this method is an array of Strings
Understanding the statement that produces output
dots separate classes, methods and objects
every java statement ends with a semicolon
out is a property of the system class
println() is a method
System is a class
Create java application that produces GUI output
A dialog box is a GUI object resembling a window in which you can display messages
You use an import statement when you want to use a built in java class
A group of classes is called a Package
Whenever a method requires multiple arguments, they are separated by commas