Presentation is loading. Please wait.

Presentation is loading. Please wait.

Units with – James tedder

Similar presentations


Presentation on theme: "Units with – James tedder"— Presentation transcript:

1 Units with – James tedder
Unit 41: Programming in Java Unit 27: Network Operating Systems Unit 46: Network Security Jamestedder.net

2 Unit 41 -Programming in Java
Week 1

3 Unit Aim To provide you with an understanding of:
The principles of programming in Java Explore the object oriented nature of the language and the multi- platform versatility offered.

4 Assignments Assignment 1
Produce training materials discussing the principles, characteristics and features of programming in Java You will critically evaluate the environmental flexibility of programming in Java. Assignment 2 Design, implement, test and document a Java program.

5 Welcome to Java! Java is Platform Independent, which means that you only need to write the program once to be able to run it on a number of different platforms! Java is portable, robust, and dynamic, with the ability to fit the needs of virtually any type of application. Java guarantees that you'll be able to Write Once, Run Anywhere.

6 Welcome to Java! Cont. More than 3 billion devices run Java. Java is used to develop apps for Google's Android OS, various Desktop Applications, such as media players, antivirus programs, Web Applications, Enterprise Applications (i.e. banking), and many more!

7 Java History Invented by James Gosling for Sun Microsystems
First developed in 1990 Originally called Oak, renamed in 1994 Became freely available in 1995 Currently owned by Oracle. 

8 Advantages of the java platform
Easy to learn.  Object-oriented.  Platform-independent.  Distributed. Secure. Robust. Multithreaded Distributed: Software that executes on two or more computers in a network. In a client-server environment, distributed applications have two parts: (1) the 'front end' that requires minimal computer resources and runs on the client computer(s), and (2) the 'back end' that requires large amounts of data crunching power and/or specialized hardware, and runs on a suitably equipped server computer. Read more: Robust: Copes with errors well. Multi threaded: Can do lot’s of this at once.

9 Disadvantages of the java platform
Performance: Java is comparatively slower and takes more memory space than the other native programming languages like C and C++.

10 Netbeans Integrated development environment for Java

11 Complete handout sheet 1 - Exercise 1 – Hello World
Exercises Complete handout sheet Exercise 1 – Hello World

12 Syntax & standards

13 Java Program Structure
In the Java programming language: A program is made up of one or more classes A class contains one or more methods A method contains program statements A Java application always contains a method called main main is the first method called when a Java application starts

14 Java Program Structure
// comments about the class public class MyProgram { } class header class body Comments can be placed almost anywhere

15 Java Program Structure
// comments about the class public class MyProgram { } // comments about the method public static void main (String[] args) { } method header method body

16 public static void main(String args[])
The method can be called from outside it’s class. Necessary because this method is being called by the Java runtime system which is not located in your current class. static Access modifier means we can call this method directly using class name without creating an object of it void Means the method does not return a value Java is platform independent language and if it will return some value then the value may mean different things to different platforms. main Name of the method. This name is fixed and as it's called by the JVM it’s the entry point for an application. String args[] These are the arguments of type String that your Java application accepts when you run it.

17 Identifiers Identifiers are the words a programmer uses in a program (variable names, class names, method names…) An identifier can be made up of letters, digits, the underscore character ( _ ), and the dollar sign Identifiers cannot begin with a digit Java is case sensitive - Total, total, and TOTAL are different identifiers By convention, programmers use different case styles for different types of identifiers, such as title case for class names - Lincoln upper case for constants - MAXIMUM

18 Reserved Words are predefined in the language, and cannot be used as identifiers
The Java reserved words: abstract assert boolean break byte case catch char class const continue default do double else enum extends false final finally float for goto if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient true try void volatile while

19 What value prints? public void test() { int myVar = 10; int MYVAR = 20; myVar = 35; System.out.println(“Value is:”+MYVAR); } A. 10 B. 20 C. 35 D. MYVAR

20 White Space Spaces, blank lines, and tabs are called white space
White space is used to separate words and symbols in a program Extra white space is ignored in Java A valid Java program can be formatted many ways Programs should be formatted to enhance readability, using consistent indentation

21 Complete handout sheet 1 – Section 6 Exercises a, b and c.


Download ppt "Units with – James tedder"

Similar presentations


Ads by Google