01 Introduction to Java Programming
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!
I will also share my notes here because I have a lesson an introduction to Java programming at school and I want to improve myself in this language.
We use Intellij IDEA as Ide. IntelliJ IDEA is an integrated development environment (IDE) written in Java for developing computer software. It is developed by JetBrains (formerly known as IntelliJ), and is available as an Apache 2 Licensed community edition, and in a proprietary commercial edition. Both can be used for commercial development.
Program: A computer program is a collection of instructions that performs a speciﬁc task when executed by a computer.
Syntax:Grammatical rules for forming instructions
Semantics:The meaning/ interpretation of the instructions
Programming :Telling a computer what to do
Machine Language:A computer’s native language, which diﬀers among diﬀerent types of computers, is its machine language — a set of built-in primitive instructions.
Assembly Language:An assembly (or assembler) language, is a low-level programming language for a computer. It uses a short descriptive word, known as a mnemonic, to represent each of the machine-language instructions.
High-Level programming language is a programming language with strong abstraction from the details of the computer.
Paradigm: A typical example or pattern of something; a pattern or model (Oxford)
Programming Paradigms: A programming paradigm is an approach to programming a computer based on a mathematical theory or a coherent set of principle
Main Programming Paradigms
Imperative Programming: commands show how the computation takes place, step by step.
Functional Programming: control ﬂow is expressed by combining function calls, rather than by assigning values to variables
example: Common Lisp,Haskell
Logical Programming:Programming by specifying a set of facts and rules. An engine infers the answers to questions.
Object Oriented Programming: Based on the concept of “objects”, which may contain data, in the form of ﬁelds, often known as attributes; and code, in the form of procedures, often known as methods.
example: Java, C++…
Interpreting Compiling Source Code
A computer cannnot understand a source program so a source program must be translated into machine code for execution. The translation can be done using another programming tool called an interpreter or a compiler.
High Level Source File →INTERPRETER →Output
High Level Source File → COMPILER→ Machine Code File→Executer→ Output
JAVA PROGRAM STRUCTURE
BASIC JAVA SYNTAX
Every java program must have -at leats- one class and each class has a name. (Class names start with an uppercase letter)
The program is executed from the main method so ın order to run a class, the class must contain a method named main.
Performs a single piece of programming action. Generally it is terminated by semi-colon(;)
If comments are multi line ,begins with /* ends with */
If comment is a single line begins with //
All the statements the block is treated as one single unit.
Syntax Errors: Detected by the compiler
For example, a missing semicolon at the end of a line or an extra bracket at the end of a function may produce a syntax error.
Runtime Errors: Causes the program to abort
There are many different types of runtime errors. One example is a logic error, which produces the wrong output. For example, a miscalculation in the source code or a spreadsheet program may produce the wrong result when a user enters a formula into a cell.
Logic Errors: Produces incorrect result
For example, assigning a value to the wrong variable may cause a series of unexpected program errors.
Thanks for reading so far. I will continue my Java journey in the next article.