Podcast
Questions and Answers
Flashcards
Computer
Computer
Electronic device that takes information and processes it to produce data.
Operating System (OS)
Operating System (OS)
Controls execution of programs and acts as interface hardware.
Application Program
Application Program
Program to perform a specific task.
Machine Language
Machine Language
Signup and view all the flashcards
Assembly Language
Assembly Language
Signup and view all the flashcards
High Level Languages
High Level Languages
Signup and view all the flashcards
Interpreter
Interpreter
Signup and view all the flashcards
Compiler
Compiler
Signup and view all the flashcards
Java Standard Edition (Java SE)
Java Standard Edition (Java SE)
Signup and view all the flashcards
Java Enterprise Edition (Java EE)
Java Enterprise Edition (Java EE)
Signup and view all the flashcards
Java Micro Edition (Java ME)
Java Micro Edition (Java ME)
Signup and view all the flashcards
JavaFX
JavaFX
Signup and view all the flashcards
JDK
JDK
Signup and view all the flashcards
Variable
Variable
Signup and view all the flashcards
Local variable
Local variable
Signup and view all the flashcards
Instance Variable
Instance Variable
Signup and view all the flashcards
Static variable
Static variable
Signup and view all the flashcards
Assignment
Assignment
Signup and view all the flashcards
Assignment expression
Assignment expression
Signup and view all the flashcards
Arithmetic Operators
Arithmetic Operators
Signup and view all the flashcards
Operator Precedence - First
Operator Precedence - First
Signup and view all the flashcards
Operator Precedence - Second
Operator Precedence - Second
Signup and view all the flashcards
Input.System
Input.System
Signup and view all the flashcards
Scanner
Scanner
Signup and view all the flashcards
Primitive Data Types
Primitive Data Types
Signup and view all the flashcards
Non-primitive Data Types
Non-primitive Data Types
Signup and view all the flashcards
Shorthand for incrementing/ decrementing a variable
Shorthand for incrementing/ decrementing a variable
Signup and view all the flashcards
Widening type
Widening type
Signup and view all the flashcards
Narrowing type
Narrowing type
Signup and view all the flashcards
Equality and Relational Operators
Equality and Relational Operators
Signup and view all the flashcards
Math
Math
Signup and view all the flashcards
Method
Method
Signup and view all the flashcards
Trigonometric Functions
Trigonometric Functions
Signup and view all the flashcards
Exponent Functions
Exponent Functions
Signup and view all the flashcards
Rounding Methods
Rounding Methods
Signup and view all the flashcards
Character Declaration and Escape Sequences
Character Declaration and Escape Sequences
Signup and view all the flashcards
Character Data Types and Operations
Character Data Types and Operations
Signup and view all the flashcards
String Data Type
String Data Type
Signup and view all the flashcards
Exception Handling
Exception Handling
Signup and view all the flashcards
Study Notes
- CE 277 is a Programming with Java course.
- The lecturers are Vincent M. Nofong, Albert K. K. Ansah, and Evans Obu.
- The course assessment comprises continuous assessment (40%) and end-of-semester examinations (60%).
- Continuous assessment includes attendance (10%), theoretical quizzes (10%), and practical quizzes and assignments (20%).
- End-of-semester examinations consist of written (30%) and practical (30%) components.
- Computers are electronic devices processing inputs to produce data.
- Modern computers contain: input devices, processors, storage devices, output devices, and software.
- An Operating System is a program that manages application programs and acts as an interface between application programs and hardware.
- An application program performs specific tasks.
- Programming languages are categorized into machine language, assembly language, high-level languages, etc.
- Machine language is the native language of computers, using binary code for instructions.
- Assembly language uses mnemonics to represent machine language instructions.
- Assemblers translate assembly language into machine code.
- High-level languages are platform-dependent, English-like, and use statements; examples include Java, C++, and Python.
- Interpreters and compilers translate source code into machine code.
Compiler vs Interpreter
- Interpreters read and execute source code statement by statement.
- Compilers translate the entire source code into a machine-code file before execution.
- Java was originally designed for consumer devices and is portable across different OS.
- Java has four platforms: Java SE, Java EE, Java ME, and JavaFX.
- Java SE develops client-side applications.
- Java EE develops server-side applications.
- Java ME develops applications for mobile devices.
- JavaFX creates rich internet applications with a user-interface API.
- Java includes an API, and language specifications available online.
- The Java Development Toolkit (JDK) is essential for Java development, containing tools like the Java Runtime Environment, compiler, etc.
Checking and Installing JDK Version
- Open command prompt or Powershell.
- Use the command
java -version
to see if java is installed. - Use the command
javac -version
to check the version.
Java Path Configuration
- Access the system's environment variables to configure the Java Path.
- Locate the installed Java directory.
- Add the JDK bin directory to the system's Path variable.
Creating Java Codes and Testing in PowerShell
- Type the code
- Save file as
MyFirstJavaCode.java
- Open PowerShell or Command Prompt
- Use the command
javac MyFirstJavaCode.java
and press Enter - With not errors, use the command
java MyFirstJavaCode
and press Enter to run the code - Students are advised to install the IntelliJ IDEA IDE.
- Different versions can be downloaded based on registration eligibility.
Elementary Programming
- A variable is a named storage location in a computer program used to hold a value of a specific data type.
- Variable declaration in Java includes specifying the data type as well as the name.
- Syntax of a variable is
dataType variableName = value
ordataType variableName
. - There are three types of variables: local, instance, and static.
- Local variables are inside a method.
- Instance variables are inside a class but outside a method and non-static.
static
variables are declared as static.- Variable names start with a letter or
_
and can not contain symbols or spaces, plus are case-sensitive. - There are primitive and non-primitive data types.
- Primitive data types in Java include byte, short, int, long, float, double, char, and boolean.
- Assignment statements assign values to variables.
- Assignment expressions represent a computation through variables, operators, and values.
Arithmetic Operators
- Java supports add add, subtract, multiply, divide.
- Expressions can be represented as:
f+7 / f-c / m * c / x/y / x mod y
- Precedence rules in Java:
*
/%
runs before+-
.
Input Reading
System.out
refers to the standard output device.System.in
refers to the standard input device.- display information to the console,
print
,println
. - Scanner or BufferedReader classes can be used to create objects that read from console using
System.in
- Scanner class can be used to create an object to read input from
System.in
Scanner input = new Scanner(System.in);
- Input objects must be closed when no longer in use.
Scanner Practical Steps
A Java program that when run:
- requires the user's name.
- accepts user input from the keyboard.
- displays a welcome message with the user's name.
numeric Data Types and operators
- Java: Six numeric datatypes, floats and integers.
- Integers include byte, short, int, long.
- Floating point includes float, and double.
Post/Pre increment and decrement data
- increment
++
- decrement
--
- Given for example i = 2
i++;
is now 3j--;
is now 1- Example assume i = 1
int j = ++i;
jis 2, i is 2int j = i++;
jis 1, i is 2int j = -i;
jis 0, i is 0int j = i--;
jis 1, i is 0
Numeric type conversion
- java assigns conversion of data from one numeric dat to another
- Always assign values of variable values based on value to an extend
- Casting converts value of one data type into another
- Casting provides widening
- Converting range from small numeric to larger, is expanding
Small to large
- Narrowing large numerical code to smaller
Equality/Relational Operators
- Java supports operators testing realtionships of variables
- Algebraic operators can be equal
- Equality shows
x == y
, x is equal - Relational provides
x > y
- Relational operators also shows operators which are <, >=, <=, Practicals Create a java code to:
- Asks time and seconds entered an integer of the user
- Accept uses input, that converts from seconds into minutes
- Then converts the times from seconds into minutes, then displays results
Random numbers Generated in range
- Generates random number of 0 to 4
- Asks the user to guess the generated number
- Accept user's inputs
- Show "Correct, YOu Won"
- High Low show message
- The code shows "Correct Too Low" and the code is off
- The other one is too low
Write code that generates 2 digit imput
- Displays the first of many
- The second and number is multiple
- Mass index, measures the health factor based on weights
- Displays BMI
Mathematical Functions
- Useful Methods Math Class
- Trigorometic methods
- Exponent Functions and methods
- Math classes shows
2 double constant PI and E
which is Math.PI and Math.E from data - Trigonomic Data Java, the value is the support function Description
- sin()
- return the trigomoetric with radien values
- Cos() trigonomatric of andgle value
- Tan) returns trigonomatic value of the angles
- toRadians()
- toDegree()
- asin
- acos
- atan
Exponent Functoins
java shows 5 exponetial functions exponent loge log base 10 sqrt Methods
Exp(X)
- loge(x)
- returns as a natural logarithmis as x
- log10(x) Square Root
Service Functions
Function can support methods such as support, max with support the value
- Java has 4 rounding functions for values Method
- Cell method value is is to rounded intergated
- Floor to give function. Methods for ABS
- The method has a given set values.
- Random will show an eqaul set
- To generate values that are not given as the random values Char types and operations
- Computer are stored number in os and 1s, which store characters.
- Character is stored using the ASCII scheme.
Unicode
Character declariation
char letter = 'B' the java statement will assign the varibale letter
Esc value to show \(slash)
is following digit
Coding, casting and converting
- Char is in every code, vice-versa
- Upper lower bit are coding process
- Upper, lower implicit
- Char can not be used, then coding required
- Comparing codes.
String Data Types
- Data is to store string sets
- Methods that for manipulation Method Description
- length() Char () concat
- returns number
- returns interger
- returns strings
Coverting functions
- The lower codes.
- Trim
- Returns String, and whitespace will be removed Statement loop if it is a true IF stateemnt has:
- ONEWAY codes
- Two way else statement
- If / else has condition
- If codes must statement to the condition
Syntax, two way must else statemnts for the code
Two if else statement is codnitional either true or force, the code example:
if(condition)
{Stateemnt}
Else{states}
MultiWay -If, loop stateemnts Inner to code, that supports another
- There is no depth given to nesting of Multi way states
Logics
-
Operation* ! && || X^ Exclusiv OR
-
It provides states: If-If else to create codes Switch Statement Statement express if that it will the codes given that
Practicals 1
- Using one way if functions- show the JAVA, take input and show to be EVEN or ODD
- Double state and ranges 7.0 - Second 6.0-Second Class lower 5.0-Pass
Loops
3 Zodiacs with codes
- loops can statements for Java. That can the
- loop statements include will "Do while", "for,"
Do while loops vs WHILELOOPS
- Do While runs and has the While look and statements to follow for loop
- It can the code after iterations
- The loop is below codes*
- for{code}` For codes is a While and For loops as well
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.