Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Development Course
Today
Programming and Software Engineering. programming paradigms . Programming Languages Java Technology
First java application ( Hello.java) Be able to compile and run any java application. Java Program Structure Variables and Data Types Operators
Computer Science
Solving Problems
Targets of programming
What is Programming
Programming
The
science of building computer software. We make computer software by writing instructions using some language which is understood by computers (as a machine).
Software Development
Linear Programming
Line by line execution Go To Example: Basic
Structured Programming
Modularity Functions Example: C
Classes
Examples: C++, JAVA,C#
Computers cant think or make decisions unless you provide them with the detailed instructions. So to solve any problem we have to make Well defined systematic steps to solve specific problem. (Algorithm) Ways of making our Algorithms
Flowchart
Pseudo
code
Flow chat
Pseudo Code
Programming Languages
The language we write software with Computer only understands machine language Languages differ in syntax, platform they run on, Applications they can do, Supported Libraries,
Examples: Assembly, C, C++, Java, Visual Basic, C#, Perl, Python, HTML, PHP, ASP, JSP.
Examples: Assembly
printf(He succeeded );
Tools
Text Editor
Example
Translator
Example
Debugger
Application that helps you to discover and solve software errors (bugs)
IDE
Java
What is java
Java is a programming language developed by SUN Microsystems (Currently acquired by Oracle) in 1995.
Originally created for controlling hardware and it was very advanced.
Java
In 1991, a small group of Sun engineers called the "Green Team, Led by James Gosling created the programming language that would revolutionize our world Java.
Aims of Java
The aims of the Java language
Simple to learn, & closely based on C++, but reduced in complexity. Object-oriented Robust: Java programs are strictly checked by software before they run Secure: Java ensures that programs running over networks cannot damage your computer files or introduce viruses. Portable: Java programs can easily be transferred from one platform (e.g. Windows) to run on another platform (e.g. Linux) with little or no change. High performance (fast) Interpreted: a key aspect of Java portability (more in Section 3). Threaded: allow a program to do several things at once. Dynamic: Java programs can adapt to changes in their environment even while the program is running.
Java Virtual Machine is the runtime environment for any java application. Being available in different operating systems makes the java application portable to any platform.
The java virtual machine has different implementation on all of these platforms. The application run inside the java virtual machine
Required Tools
You need
Java Compiler
JDK
Java Platforms
Currently Java Platform has many editions suitable for different type of applications. J2SE: Desktop Apps J2EE: Web Apps J2ME: Mobile Apps
Related Technology
Android & BlackBerry JSP (Java Server pages) and Servlets JSF (java server faces)
Write ;PATHOFJAVABIN without the quotes at the end of the value stored in the Path environment variable. Example: ;C:\Program Files\Java\jdk1.7.0\bin Do not forget the semicolon ; before the path
First application
public class Hello {
public static void main(String[] args) { System.out.println("Hello Java"); }
Save it As Hello.java
Write your java code in any text editor and save it in .java format
javac Hello.java
java Hello
Classes
Object - Objects have states and behaviours. Example: A dog has states - colour, name, breed as well as behaviours -wagging, barking, eating. An object is an instance of a class. Class - A class can be defined as a template/blue print that describes the behaviours/states that object of its type support.
Attributes (properties)
Instance variables: Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded. Instance variables can be accessed from inside any method, constructor or blocks of that particular class.
Constructors
When discussing about classes, one of the most important sub topic would be constructors. Every class has a constructor. If we do not explicitly write a constructor for a class the Java compiler builds a default constructor for that class.
Each time a new object is created, at least one constructor will be invoked. The main rule of constructors is that they should have the same name as the class. A class can have more than one constructor.
Methods
A Java method is a collection of statements that are grouped together to perform an operation.
// Constructor
// Methods
private datatype property_name ; Example : private String name ; private int number ; private String color ;
Create Constructor
public class_name () { // statments }
Example : public car () { color = red ; }
Create Methods
public returntype method_name () { //Statments } Example : Public void move () { x=x+1; }
{
// Attributes private int modelNumber; private String color ; private int x ;
x = x +1 ;
} }
Any Questions ?
END