0% found this document useful (0 votes)
16 views

Java Programming-1

The document discusses Java programming concepts including hardware and software, programming languages, the Java compiler and virtual machine, variables, data types, operators, control structures like if/else and loops. It also covers the NetBeans IDE and GUI components like labels, text fields, checkboxes and lists.

Uploaded by

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

Java Programming-1

The document discusses Java programming concepts including hardware and software, programming languages, the Java compiler and virtual machine, variables, data types, operators, control structures like if/else and loops. It also covers the NetBeans IDE and GUI components like labels, text fields, checkboxes and lists.

Uploaded by

cawilyare9885
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

JAVA PROGRAMMING

Chapter One: Java Programming


• Computer: is an electronic device that stores and processes data.
• A computer includes both hardware and software:-
• Hardware:is the physical aspect of the computer that can be seen.
• Software:is the invisible instructions that control the hardware and make it work.
• Computer programming:consists of writing instructions for computers to perform task.
• The Central Processing Unit (CPU): is the brain of a computer.
• Memory: is to store data and program instructions for CPU to execute.
• Memory Unit: is an ordered sequence of bytes, each holds eight bits.
• A byte:is the minimum storage unit.
• Input and Output Devices:-
• The common input devices are keyboard and mouse.
• The common output devices are printers and monitors.
• Operating System (OS):is the most important program that manages and controls a
computer’s activities.
• Application programs: such as an Internet browser and a word processor cannot run
without an operating system.
• Multiprogramming: allows multiple programs to run simultaneously by sharing the
CPU.
• Multithreading: allows concurrency within a program, so that its subunits can run at
same time.
• Multiprocessing, or parallel processing:uses two or more processors together to
perform a task.
• Java: is a Computer programming language.
• Java: is Application programming Language.
• Java: is the Internet program language.
• Java enables programmers to write computer instructions using English-based
commands instead of having to write in numeric codes.
• Java was designed with a few key principles in mind:
• Ease of Use: The fundamentals of Java came from a programming language called
C++.
• Reliability: Java needed to reduce the likelihood of fatal errors from programmer
mistakes.
• Security : Java is probably the most secure programming language to date.
• Platform Independence: Programs need to work regardless of the machines it
is being executed on.
• Characteristics of Java:-
• Java is simple : Java is designed to be easy to learn.
• Java is object-oriented : In Java, everything is an Object.
• Java is Platform Independent : it is not compiled into platform specific machine.
• Java is secure : With Java's secure feature it enables to develop virus-free, tamper-
free systems.
• Java is architectural neutral : Java compiler generates an architecture-neutral
object file format.
• Java is portable : Being architecture-neutral and having no implementation
dependent aspects of the specification makes Java portable.
• Advantages of Java Programming:-
• Java is simple
• Java is object-oriented
• Java is distributed
• Java is interpreted
• Java is robust
• Java is multithreaded
• Java is dynamic
• Java is secure
• The Java compiler translates Java programs into byte‐code.
• Java Virtual Machine (JVM): translates the byte code into machine language.
• Portable: means that a program may be written on one type of computer and then run on
a wide variety of computers.
• JDK: consists of a set of separate programs for developing and testing Java programs,
each of which is invoked from a command line.
• Reserved words or keywords: are words that have a specific meaning to the compiler
and cannot be used for other purposes in the program.
• Statement: represents an action or a sequence of actions.
• Blocks: a pair of braces in a program forms a block that groups components of a
program.
• Class: is the essential Java construct. A class is a template or blueprint for objects.
• What is System.out.println ?
• system.out is known as the standard output object.
• Method: a collection of statements that performs a sequence of operations to display a
message on the console.
Chapter Two: Elementary Programming
• Variable: is a named storage location that stores data and the value of the data may
change while the program is running.
• Local Variable : A variable which is declared inside the method is called local variable.
• Instance Variable: variable that is declared inside the class but outside the method, is
called instance variable.
• Static variable:variable that is declared as static is called static variable. It cannot be
local.
• Data types:represent the different values to be stored in the variable.
• There are two types of data types:
• Primitive data types:are predefined by the language and named by a keyword.
• Non-primitive data types
• Declaring a variable:tells the compiler to allocate appropriate memory space for the
variable based on its data type.
• Reference variable:can be used to refer to any object of the declared type, or of a
subtype of the declared type (a compatible type).
• Constant: contains information that does not change during the course of program
execution.
• Operators: are symbols (+) (*) that are used in expressions to manipulate operands.
• Binary operator:requires an operand before and after the operator.
• e.g: 5-3
• Unary operator: requires a single operand either before or after the operator.
• e.g: -5.
• Operands: are variables and literals contained in an expression.
• Expression: is a literal value or variable that can be evaluated by the Java Program
to produce a result.
• Literal: is a value such as a literal string or a number.
• Array: contains a set of data represented by a single variable name.

• Java Language Supports different types of Operators:-


• Arithmetic operators
• Assignment operators
• Comparison operators
• Increment/Decrement operators
• Logical operators
• String operators

Chapter Three: Control Structures


• A typical programming task can be divided into two phases:
• Problem solving phase:-
• produce an ordered sequence of steps that describe solution of problem.
• this sequence of steps is called an algorithm.
• Implementation phase:-
• implement the program in some programming language.

• Pseudocode is an artificial and informal language that helps programmers develop


algorithms.
• (Dictionary) A schematic representation of a sequence of operations, as in a
manufacturing process or computer program.
• (Technical) A graphical representation of the sequence of operations in an information
system or program.
• Program flowcharts show the sequence of instructions in a single program or
subroutine.
• If Statement: An if statement consists of a Boolean expression followed by one or more
statements.
• If..Else Statement: An if statement can be followed by an optional else statement,
which executes when the Boolean expression is false.
• Nested If Statement: You can use one if or else if statement inside another if or else
if statement(s).
• Switch Statement : A switch statement allows a variable to be tested for equality against
a list of values.
Chapter Four: Repetition Control Structures
• Loops: are structures that control repeated executions of a block of statements.
• Loop statement:is a control structure that repeatedly executes a statement or a series
of statements while a specific condition is true or until a specific condition becomes
False.
• While statement: keeps repeating until its conditional expression evaluates to false
• Counter:is a variable that increments or decrements with each iteration of a
loop statement.
• Do while loop: Executes a statement or statements once, then repeats the execution as
long as a given conditional expression evaluates to true.
• For loop:is useful when you know how many times a task is to be repeated.

Chapter Five: NetBeans IDE Exploration


• The Palette: contains all components which you can use while making a GUI
application.
• Design Area:is where you can drag the components from Pallet and design the GUI
application.
• jLabel: it is a label used to display a single line text in application.
• jTextField: It is used to take a input from user in a application.
• jTextArea: It is used to display multi line text, it also supports line wrap. We can make it
editable or non-editable by changing property.
• jCheckbox: A checkbox is a labelled toggle switch. Each time the user clicks it, its state
toggles between checked and unchecked.
• JRadioButton: Radio buttons are similar to checkboxes, but they are usually arranged in
groups.
• jList: It is a list of items from which selections can be made.
• jComboBox: It provides a dropdown list of items. New Items can be added to it.

You might also like