1 / 16

Lab Information Security Using Java (Review)

Lab Information Security Using Java (Review). Lab#0 Omaima Al- Matrafi. Office# 78-A Office hours : S.M.W 10-11 S…W 12:30-2 Email : omaima_almatrafi@yahoo.com. Java - General. Java is: High level language similar to C++ in syntax

mya
Download Presentation

Lab Information Security Using Java (Review)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab Information SecurityUsing Java (Review) Lab#0 Omaima Al-Matrafi

  2. Office# 78-A • Office hours : S.M.W 10-11 S…W 12:30-2 • Email : omaima_almatrafi@yahoo.com

  3. Java - General • Java is: • High level language similar to C++ in syntax • Platform independent programming language

  4. Java Interpreter Just in Time Compiler How it works…! Compile-time Environment Compile-time Environment Class Loader Bytecode Verifier Java Class Libraries Java Source (.java) Java Bytecodes move locally or through network Java Virtual machine Java Compiler Runtime System Java Bytecode (.class ) Operating System Hardware

  5. How it works…! • Java is independent only for one reason: • Only depends on the Java Virtual Machine (JVM). • The Java compiler produces a special format called byte code, which is interpreted by the resident JVM (regardless of computer architecture), • JIT (just in time) compilers attempt to increase speed. Write Once, Run everywhere

  6. Java Features • Portable - Write Once, Run Anywhere • Automatic memory management • Designed for network programming • Multi-threaded (multiple simultaneous tasks) • Dynamic & extensible (loads of libraries) • Classes stored in separate files • Loaded only when needed • Security has been well thought through

  7. Java lets you write special programs called applets that can be downloaded from the Internet and played safely within a web browser. • Java restricts what an applet can do. • A Java applet cannot write to your hard disk without your permission. • It cannot write to arbitrary addresses in memory and thereby introduce a virus into your computer. • It should not crash your system.

  8. Software required: • Java Development Kit (JDK) version 5 • Download: http://java.sun.com/javase/ • JCreator LE version • http://www.jcreator.org/download.htm

  9. (JDK) is a Sun Microsystems product aimed at Java developers. • Some of JDK contents: • java – The loader for Java applications. This tool is an interpreter. • javac – The compiler, which converts source code into Java bytecode . • jar – The archiver, which packages related class libraries into a single JAR file. • jdb – The debugger • appletviewer – This tool can be used to run and debug Java applets without a web browser. Java Development Kit (JDK)

  10. A Class : A class defines the abstract characteristics of a thing and its behavior. An Object : An exemplar of a class. it consists of state and related behavior. An object stores its state in fields and exposes its behavior through methods. Inheritance: programming allows classes to inherit commonly used state and behavior from other classes. use the extends keyword, followed by the name of the class to inherit from: class subClassextendssuperClass Some Object-Oriented Terminology

  11. Interface: just like classes except that they use the word interface instead of class and is restricted to containing method declarations without bodies. Interface interface_name { } And to use the interface in the class definition: Public class class_name implements interface_name { } • A package: is a namespace that organizes a set of related classes and interfaces. The Java platform provides an enormous class library (a set of packages). This library is known as the "Application Programming Interface", or "API“. Some Object-Oriented Terminology

  12. Variables • Instance Variables (Non-Static Fields) • Class Variables (Static Fields) • Local Variables (method’s variables) • Parameters • Primitive Data Types: byte, short, int, long, float, double, boolean, char. • Arrays Language Basics

  13. For writing a java program to read file line by line: • Use import java.io.*; • DefineFileInputStream object to obtain input bytes from a file in a file system (to open the file). • Define DataInputStream object to let an application read primitive Java data types from an underlying input stream in a machine-independent way. • Define InputStreamReader object which is used as a bridge from byte streams to character streams. Reading from a file

  14. Define BufferedReaderobject to Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. • Read File Line By Line using readLine() method of BufferedReaderobject. • Close the input stream. Reading from a file Cont.

  15. http://java.sun.com/docs/books/tutorial/java/index.html GOOD LUCK  Good References

  16. Practice to write to a file… You will need that later in your HWs. For writing to a file, you will need to use FileOutputStreamobject. Need to do…

More Related