Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Java Question HASHI

Uploaded by

Ismacum Ahm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Java Question HASHI

Uploaded by

Ismacum Ahm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Prepared By: Mohamed Hassan Hashi

CH 1
Introduction to Computers, the Internet & Java
Java supported three programming paradigms:
procedural programming, OOP and generic programming.
computer programs: Computers process data under the control of
sequences of instructions.
Hardware: computer devices (keyboard, screen, mouse).
Types of java edition:
-Java Standard Edition: contains the capabilities needed to develop
desktop and server applications.
-Java Enterprise Edition (Java EE): is geared toward developing large-
scalenetworking applications and web-based applications.
-Java Micro Edition: is geared toward developing applications for
resource-constrained embedded devices.
Moore’s Law: the capacities of computers have almostdoubled
inexpensively.
Computers can bedivided into various logical units or sections:
-Input unit: This “receiving” section gets information from input devices
and places it at the disposal of the other units for processing.
-output unit: This “shipping” section takes information the computer has
processed and places it on various output devices.
-Memory unit: retains processed information until it can be placed on
output devices by the output unit.
-Secondary storage unit: This is the long-term, high-capacity
“warehousing” section.
-Arithmetic and logic unit (ALU): This “manufacturing” section performs
calculations
Prepared By: Mohamed Hassan Hashi
-Central processing unit (CPU): This “administrative” sectionsupervises
the operation of the other sections.
Data Hierarchy: Data items processed by computers form a data
hierarchy that becomes larger and more complex in structure.
Bits: The smallest data item in a computer can assume the value 0 or 1.
Characters: Digits, letters and special symbols.
Unicode: characters that are composed of one, two or four bytes.
Field: is a group of characters that conveys meaning.
Record: is a group of related fields.
File: is a group of related records.
Database: is a collection of data that’s organized for easy access and
manipulation.
Model: is the relational database in which data is stored in simple tables.
Big data: applications deal with massive amounts of data.
Types of programming languages:
- Machine languages: consist of strings of numbers that instruct
computers to perform their most elementary operations one at
a time.
-Assembly languages: English-like abbreviations that represent
elementary operations.
-High-level languages: Single statements accomplish
substantial tasks.
Assemblers: Translator programs.
Compilers: convert high-level language programs into machine language.
Interpreters: Compiling a high-level language program into machine
language.
Reuse: helps you build effective systems.
Prepared By: Mohamed Hassan Hashi
Interfaces: collections of related methods that typically enable you to
tell objects what to do, but not how to do it.

Java is an object-oriented programming language developed by James


Gosling and colleagues at Sun Microsystems in the early 1990s.
Sun Microsystems in 1991 funded an internal corporate research project
led by James Gosling, which resulted in a C++- based object-oriented
programming language that Sun called Java .
Methods: houses the program statements that actually perform its
tasks.
Classes: house the set of methods that perform the class’s tasks.
Java Development Environment phases:
Edit – Compile – Load – Verify - Execute
Integrated development environments (IDEs): Provide tools that support
the software development process.
logic errors: errors that cause programs to execute incorrectly.
Class loader:takes the class filesand transfers them to primary memory.
just-in-time (JIT) compilation: Analyzes the bytecodes as they’re
interpreted.
compiler—translates the bytecodes into the computer’s machine
language.

CH 2
Introduction to Java Applications; Input / Output and
Operators
Java application: Acomputer program that executes when you use
thejava commandtolaunch the Java Virtual Machine (JVM).
Comments: Usedtodocumentprogramsand improve their readability.
Prepared By: Mohamed Hassan Hashi
Traditional comment: canbe spread over several lines.
Javadoc comments: Enableyou to embed program documentation
directly in your programs.
Javadocutility program: readsJavadoc comments and uses them to
prepare program documentation in HTML format.
Blank lines: space characters andtabs.
classkeyword:introduces a class declaration and is immediately followed
by theclassname.
Keywords :arereserved for use by Java and are always spelled with all
lowercase letters.
Identifier: aseries of characters consisting of letters, digits, underscores
)_(anddollar signs )$( that does not begin with a digit and does not
contain spaces.
Standardoutput object: Allowsa Java application to display information
in thecommand window.
\n: Newline. Position the screen cursor at the beginning of the next line
\t: Horizontal tab. Move the screen cursor to the next tab stop.
\r: Carriage return. Position the screen cursor at the beginning of the
current line.
\\: Backslash. Used to print a backslash character.
\": Double quote. Used to print a double-quote character.
Integers: Wholenumbers.
Variables: locationin the computer’s memory where a value can be
stored for use later in a program.
Import declaration: Helps the compiler locate a class that is used in this
program.
Packages: named groups of related classes and are collectively referred
toas theJavaclass library.
Scanner: Enables a program to read data foruse in a program .
Prepared By: Mohamed Hassan Hashi
Standardinput object (System.in): enables applications to read bytes of
data typed by the user.
Expressions: isany portion of a statement that has a value associated
with it.
Theasterisk )*(:indicates multiplication.
Thepercent sign )%(:istheremainderoperator.
Rules of operator precedence:
Multiplication, division andremainder operations are applied first
Additionand subtraction operations are applied next.
ifselectionstatement: Allowsa program to make adecisionbased on a
condition’s value.
Prompt: directs the user to take a specific action.

CH3
Introduction to Classes, Objects, Methods and
Strings

Return type: (which appears before the method name) specifies the type
of data the method returns to its caller after performing its task.
Variables: declared in a particular method’s body (such as main).
MiddleCompartment: contains the class’s attribute name, which
corresponds to the instance variable of the same name in Java.
Java’s types are divided into:
primitive types and reference types
primitive-type: variable can hold exactly one value of its declared type at
a time.
reference types: are All nonprimitive.
difference between constructors and methods:
Prepared By: Mohamed Hassan Hashi
constructors cannot return values, so they cannot specify a return type.
floating-point number: a number with a decimal point.
single-precision floating-point numbers: d can hold up to seven
significant digits.
Double precision floating-point numbers: can hold up to 15 significant
digits.
Floating point literals: are values in the source code.
javax.swing package: this package contains many classes that help you
create graphical user interfaces (GUIs).
GUI components: facilitate data entry by a program’s user and
presentation of outputs to the user.
input dialog: that allows the user to enter data into a program.
showInputDialog: to display an input dialog containing a prompt and a
field.

CH 4
Java Loops/ Repetitions
while and for statements: perform the action(s) in their bodies zero
or more times.
The do while: statement performs the action(s) in its body one or
more times.
Counter-controlled repetition requires:
-control variable (or loop counter). - initial value of the control
variable. -the increment. - loop-continuation condition.
for repetition statement: Specifies the counter-controlled-repetition
details in a single line of code.
The general format of the for statement is:
Prepared By: Mohamed Hassan Hashi
for (initialization; loopContinuationCondition;
increment)statement.
the initialization expression:names the loop’s control variable
and optionally provides its initial value.
loopContinuationCondition:determines whether the loop
should continue executing.
increment:modifies the control variable’s value.
The general format of the while statement is:
initialization;
while (loopContinuationCondition)
{
statement
increment;
}
local variable:can be used only in the method that declares it
and only from the point of declaration through the end of the
method.
The general format of the dowhile statement is:
do
{
statement
} while (condition);
The while: the program tests the loop-continuation condition at the
beginning of the loop, before executing the loop’s body; if the condition
is false, the body never executes.
The do…while statement: tests the loop-continuation condition after
executing the loop’s body; therefore, the body always executes at
least once.
Different between print printf println:
Print: to display a string.
Printf: displays formatted data.
Prepared By: Mohamed Hassan Hashi
println, after displaying its argument, print does not position the
output cursor at the beginning of the next line in the command
window—the next character the program displays will appear
immediately after the last character that print display.
Pseudocode: is an informal language that helps you develop algorithms
without having to worry about the strict details of Java language syntax.
repetition statement: allows you to specify that a program should repeat
an action while some condition remains true.
pseudocode statement: describes the repetition during a shopping trip.
compound assignment operators:abbreviate assignment expressions.
Difference Between Prefix Increment and Postfix Increment Operators:
prefix increment use ++ sign
Postfix Increment use-- sign
PaintComponent: the system automatically calls every time it needs to
display the DrawPanel.

Prepared By :MOHAMED HASSAN HASHI

You might also like