Introduction to java programming language, Lecture notes of Computer science

An introduction to Java programming language. It explains the basic concepts of Java, Java platforms, JVM, and JVM basic terminologies. It also covers creating, compiling, and running programs, integer and floating-point literals, increment and decrement operators, numeric type conversions, two-way if statements, nested loop statements, and formatting console output. useful for beginners who want to learn Java programming language.

Typology: Lecture notes

2022/2023

Available from 06/19/2023

daliaskzbn
daliaskzbn 🇪🇬

1 document

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JAVA
P R O G R A M M I N G L A N G U A G E
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Introduction to java programming language and more Lecture notes Computer science in PDF only on Docsity!

JAVA

P R O G R A M M I N G L A N G U A G E

Java

Concepts

  • Java is an object-oriented

programming language providing

syntax and Semantics to develop

applications.

  • Java is a platform which provides its

own Runtime Environment to execute

java programs.

  • Java programs are not executed by

OS directly, java programs are

executed by a special mediator

software called JVM.

  • Java is a technology ; it simplify java

projects development by providing a

rich setup pre-defined or API.

The Java

Programming

Features

Features of

Java

Java Platforms

1. Java SE : stands for java platform standard edition.

It provides concepts for developing stand-alone and GUI applications, applets(client side executing application),DIA(Database Interaction application), DA(Distributed application),IA(Integrated applications)

2. Java EE : stands for java platform enterprise.

It provides concepts server-side programming that is web applications and enterprise applications.

3.Java ME: for java platform micro edition.

It provides concepts for developing micro programs to embed in electronic devices such as mobiles. In olden days, mobile applications are developed by using java ME. But now-a-days mobile applications are developed using android, It is internally developed by using Java SE.

4.Java FX / OpenJFX: Java Special effects

JavaFX is a platform for creating rich internet applications using a lightweight user-interface API. JavaFX applications may be clients of Java EE platform services

JDK ,JRE &JDK

Java Virtual Machine

  • It is program written in C++ which is responsible for

converting Byte code to machine specific code.

  • Java source code compile bytecode --> execute on JVM.
  • The JVM is used for both - translate the bytecode into the

machine language for a particular computer and execute the

corresponding machine-language instructions as well.

JVM

JDK ,JRE &JDK

Java Runtime Environment

  • JRE includes JVM itself plus java binaries and classes

which are needed to execute program.

JRE JVM

Basic

Terminologies

  • Source code : Developer written program; it is written according to the programming language syntax.
  • Compiled code: Compiler generated program that is converted from source code. ➢ compiler: it is a translation program that converts source code into machine language at once. ➢ interpreter : it is also a translation program that converts source code into machine language but line by line.
  • Executable code : OS understandable readily executable program(.exe files)
  • Compilation : It is a process of translating source code into compiled code.
  • Execution : It is a process of running compiled code to get output.

Basic

Terminologies

  • A platform is an environment in which a program is loaded and executed. A platform can be software only or hardware only platform or both. Computer platform is both software and hardware platform it is OS and Hardware devices.
  • platform dependent application : An application that is compiled in one operating system, if it is not running in different operating system then that application is called platform dependent application. The programming language that is used to develop this application is called platform dependent programming language. C,C++ programming languages are platform dependent programming languages, because these languages program compiled code does not run in different OS.

Compiling Java

Source Code

  • Java was designed to run object programs on any platform. With Java, developer write the program once, and compile the source program into a special type of object code, known as bytecode. The bytecode can then run on any computer with a Java Virtual Machine. Java Virtual Machine is a software that interprets Java bytecode.

Program Execution

The output

Fix The Error

The output

Read input from Console & constant

The output

Assignment Statements and Assignment Expressions The output

Integer Literals

  • An integer literal can be assigned to an integer variable if it can fit into the variable.
  • A compile error will occur if the literal is too large for the variable to hold.
  • The statement byte b = 128 , for example, will cause a compile error , because 128 cannot be stored in a variable of the byte type. (Note that the range for a byte value is from – 128 to 127 .)
  • An integer literal is assumed to be of the int type, whose value is between - 2 31 (- 2147483648 ) and 2 31 - 1 ( 2147483647 ).
  • To denote an integer literal of the long type, append the letter L or l to it. For example, to write integer 2147483648 in a Java program, you must write it as 2147483648 L or 2147483648 l , because 2147483648 exceeds the range for the int value.