You are on page 1of 43

WELCOME

Making the most


of this course
No required
programming experience
No required
platform
No Required
Background
WHAT IS PROGRAMMING?
“A computer program is a
set of instructions…”
Turn right
Drive one mile
Turn left on bank

Take the second right


Fourth house on the left
Turn Right
Drive One Mile
200 + 300 = 500
STATEMENTS

BASIC LET Balance =500

AppleScript set balance to 500

Java balance = 500;

COBOL MOVE 500 TO BALANCE


What is a programming language?
• Is the ability to take the idea into your head
• Break it a part into each individual pieces and
now write those pieces into your programing
language using at a time.
• Writing Your statement in a right order with
right syntax
C
C++
C#
Java
JavaScript
Perl
PHP
Python
Objective-C
Ruby
Visual basic
JavaScript, ActionScript
High-Level
Ruby, Python, PHP Languages

Java, C#, VB.NET

Objective-C

C++

C
Low-Level
Assembly Language Languages

Machine code
CPU
Writing Source Code
ALGOL 68 Python 3 Lua
PRINT(“HELLO, WORLD!”)
ALGOL 60

BEGIN
DISPLAY (“HELLO, WOLRD!”);
END.
C

#INCLUDE <STUDIO.H>

INT MAIN(VOID)
{
PRINTF(“HELLO, WORLD\N”);
RETURN 0;
}
C#

USING SYSTEM;

CLASS EXAMPLE
{
STATIC VOID MAIN(STRING[] ARGS)
{
CONSOLE.WRITELINE(“HELLO WORLD!”);
}
}
Java
public class Helloworld{
public static void main(String[] args){
System.out.println(“hello, world!”);
}
}
TRANSLATORS
• But whatever we write has to be converted down to machine code before it can
run

• There are two main ways of doing this: what's called compiling the source code and
interpreting the source code.

• Compiler is a piece of code that translates the high level language into machine
language as a whole.
 The compiler translates the entire program in one go and then executes it.
• Interpreter also is a piece of code that translates the high level language into machine
language but line by line.
 Interpreter takes one statement then translates it and executes it and then takes
another statement.
WHAT HAPPENS
• If you write your source code and then you have a program called a compiler.
 It will go through that source code and create a separate file that contains the machine
code.
 This end result is sometimes referred to as an executable file.
 You can now just run your program, keeping your source code private.

• Now, with an interpreted language on the other hand,


 You don't compile your source code beforehand.
 You just give me a copy of it So I'll need my machine to interpret it whenever I want to
run that program.
DIFFERENCE BETWEEN COMPILED AND INTERPRETED LANGUAGES

COMPILED INTERPRETED

Pros cons Pros Cons


Ready to run Not Cross-plateform Cross-plateform Interpreter required

Often faster inflexible Simpler to test Often slower

Source code is Extra step Easier to debug Source code is


private public
INTERMEDIATE LANGUAGES
• Now, because there are good things about compiled languages and good things
about interpreted languages,
• There is also a third way of doing this which is a bit of both.
• Instead of the compiled model where all the work is done upfront but can be a
little bit inflexible or the interpreted model where all the work is done on the
receiving end but can be a little bit slower.
• Upfront we compile it part of the way to what's called an intermediate language.
• Which takes it as far along the way to machine code as it can get while still being
portable often across platforms.
LANGUAGE EXAMPLES

Compiled C, C++, and Objective-C


Interpreted HTML, PHP and JavaScript
Intermediate hybrid Java, C#, VB.NET, and Python
WHERE JAVA IS USED
WHERE JAVA IS NOT USED

• JavaScript
• Not Native Mobile Apps for Iphone or Windows
TYPES OF JAVA APPLICATION

• Games
• Mobile Apps
• Cloud Computing(is the internet-based storage for files,
applications, and infrastructure)
• Databases
• Websites
HISTORY OF JAVA
HISTORY OF JAVA
HISTORY OF JAVA
RUNTIME ARCHITECTURE
JVM, JRE AND JDK
• JVM (Java Virtual Machine) is an abstract machine. It is a specification that
provides runtime environment in which java bytecode can be executed.

• JRE (Java Runtime Environment) is used to provide runtime environment.It is


the implementation of JVM.It physically exists.It contains set of libraries + other
files that JVM uses at runtime.

• JDK (Java Development Kit) it physically exists. And contains JRE +


development tools.
FIRST JAVA PROGRAM-EXAMPLE
/*This is a simple java program*/
class Example
{
public static void main (String ar[])
{
System.out.println (“This is a simple Java program”);
}
}
class This marks the starting of java code. It is a key word of java.

public This specify the main ( ) is accessible from outside of the class

static This specify that to execute main ( ) even no class objects have been
created

void This specify that method does not return value

main JVM is responsible to execute main method

String ar[] String Array data type, species that main takes some arguments
when executed (Note that is no argument specified then Sting array
takes null as the argument, hence no error occurs).

System This is name of the class that contains the object

out It is static data member of System class

println This is the method which prints the output in the dos command.
KEYWORDS
• The following keywords are reserved in Java, so you must not use them as
class names in your programs

abstract case continue extends goto int package short synchronized try

assert catch default final if interface private static this void

boolean char do finally implements long protected strictfp throw volatile

Break class double float import native public super throws while

Byte const else for instanceof new return switch transient  

You might also like