SAZ4A/SAE4A/BPC41 PROGRAMMING IN JAVA Unit : I - V

Size: px
Start display at page:

Download "SAZ4A/SAE4A/BPC41 PROGRAMMING IN JAVA Unit : I - V"

Transcription

1 SAZ4A/SAE4A/BPC41 PROGRAMMING IN JAVA Unit : I - V

2 UNIT I -- Introduction to Java -- Features of Java -- Basic Concepts of Object Oriented Programming -- Java Tokens -- Java Statements -- Constants -- Variables -- Data Types -- Type Casting -- Operators -- Expressions -- Control Statements: Branching and Looping Statements. 2

3 Introduction to JAVA Programming James Gosling and Sun Microsystems Oak Java, May 20, 1995, Sun World HotJava : The first Java-enabled Web browser JDK Evolutions : J2SE, J2ME, and J2EE 3

4 Features of JAVA Programming TM 4

5 Object Oriented Programming TM An object Oriented Programming consists of many well-encapsulated objects and the objects interact with each other by sending messages. 5

6 Object Oriented Programming TM Concepts An object contains both data and methods that manipulate that data An object is active, not passive; it does things An object is responsible for its own data, But: it can expose that data to other objects. 6

7 JAVA Tokens Tokens are the various Java program elements which are identified by the compiler. A token is the smallest element of a program that is meaningful to the compiler. 7

8 JAVA Constants -- A constant is a value that never changes during the life of a program-- -- In Java, we use the keyword final in front of a declaration to change it from a variable into a constant. Example: final double PI = 3.14; final double PST = 0.08; 8

9 Variables in JAVA TM A variable provides us with named storage that our programs can manipulate. Each variable in Java has a specific type, which determines the size and layout of the variable's memory. 9

10 Data Types in JAVA TM The data type of a value (or variable) is an attribute that tells what kind of data that value can have. 10

11 Type Conversion in JAVA TM When we assign a value of one data type to the variable of different data type, type conversion must be done in order to match the destination data type. syntax: variable1=(variable1 data type)variable2; 11

12 Operators in JAVA TM Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. 12

13 JAVA Translation Java source code Java bytecode Java compiler Bytecode interpreter Bytecode compiler The Java compiler (javac) converts the source code into bytecode. Bytecode is a kind of average machine language. This Machine bytecode file (.class file) can be run on any operating system by code using thejava interpreter (java) for that platform. The interpreter is referred to as a Virtual Machine. Thus, Java is an example of a Virtual Machine programming Language. 13

14 Basic Program Development TM 14

15 Sample JAVA Program public class sample { // // Prints a presidential quote. // public static void main (String[] args) { System.out.println ("A quote by Abraham Lincoln:"); } } System.out.println ("Whatever you are, be a good one."); 15

16 Control Statements in JAVA TM Control statements enable us to specify the flow of program control; ie, the order in which the instructions in a program must be executed. They make it possible to make decisions, to perform tasks repeatedly or to jump from one section of code to another. Video Link: 16

17 UNIT II -- Classes, Objects and Methods -- Constructors -- Methods Overloading -- Inheritance -- Overriding Methods -- Finalizer and Abstract Methods -- Visibility Control -- Arrays, Strings and Vectors -- StringBuffer Class -- Wrapper Classes 17

18 Classes, Objects and Methods An object is defined by a class. A class is the blueprint of an object. The class uses methods to define the behaviors of the object. The class that contains the main method of a Java program represents the entire program. A class represents a concept, and an object represents the embodiment of that concept. Multiple objects can be created from the same class. 18

19 Constructors in JAVA Constructor is a special method that gets invoked automatically at the time of object creation. Constructor is normally used for initializing objects with default values unless different values are supplied. Constructor has the same name as the class name. Constructor cannot return values. A class can have more than one constructor as long as they have different signature (i.e., different input arguments syntax). 19

20 Method Overloading Same name, different arguments. Code deals with different argument types rather than forcing the caller to do conversions prior to invoking your method. It can have a different return type. Argument list must be different. Access modifier can be different. A method can be overloaded in the same class or in a subclass. 20

21 INHERITANCE JAVA INHERITANCE 21

22 Overriding Methods The child class provides alternative implementation for parent class method. The key benefit of overriding is the ability to define behavior that's specific to a particular subclass type. Overridden method: In the superclass. Overriding method: In the subclass. Rules of Method Overriding The overriding method must NOT throw checked exceptions that are new or broader than those declared by the overridden method. A checked exception is an exception that is checked at compile time. The compiler will complain if a checked exception is not handled. Examples of checked exceptions: IOException,FileNotFoundException, EOFException 22

23 Overloaded and Overridden Methods 23

24 Visibility Control in JAVA 24

25 Arrays An array is a group of like-typed variables that are referred to by a common name. Arrays in Java work differently than they do in C/C++. In Java all arrays are dynamically allocated. Since arrays are objects in Java, we can find their length using member length.. Video Link : 25

26 String Buffer, String Builder and String Tokenizer String is immutable, if you try to alter their values, another object gets created. StringBuffer and StringBuilder are mutable so they can change their values. 26

27 Constructors of String Buffer Class Constructor of String Buffer Class Description StringBuffer() creates an empty string buffer with the initial capacity of 16. StringBuffer(String str) creates a string buffer with the specified string. StringBuffer(int capacity) creates an empty string buffer with the specified capacity as length. 27

28 JAVA Wrapper Classes All the wrapper classes (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract class Number. The object of the wrapper class contains or wraps its respective primitive data type. Converting primitive data types into object is called boxing, and this is taken care by the compiler. 28

29 Wrapper Classes An object of a wrapper class can be used in any situation where a primitive value will not suffice Primitive values could not be stored in such containers, but wrapper objects could be stored. 29

30 UNIT III -- Interfaces -- Packages -- Creating Packages -- Accessing a Package -- Multithreaded Programming -- Creating Threads -- Stopping and Blocking a Thread -- Life Cycle of a Thread -- Using Thread Methods -- Thread Priority -- Synchronization -- Implementing the Runnable Interface 30

31 Interface An interface is similar to an abstract class with the following exceptions: All methods defined in an interface are abstract. Interfaces can contain no implementation Interfaces cannot contain instance variables. However, they can contain public static final variables (ie. constant class variables) Interfaces are declared using the "interface" keyword. If an interface is public, it must be contained in a file which has the same name. Interfaces are more abstract than abstract classes Interfaces are implemented by classes using the "implements" keyword. 31

32 Declaring an Interface public interface Steerable { public void turnleft(int degrees); public void turnright(int degrees); } public class Car extends Vehicle implements Steerable { public int turnleft(int degrees) { [...] } public int turnright(int degrees) { [...] } When a class "implements" an interface, the compiler ensures that it provides an implementation for all methods defined within the interface. 32

33 JAVA Packages Package: A Package is a collection of related classes. It can also "contain" sub-packages. Sub-packages can have similar names, but are not actually contained inside. java.awt does not contain java.awt.event Uses of Java packages: Group related classes together. As a namespace to avoid name collisions. Provide a layer of access / protection. Keep pieces of a project down to a manageable size. 33

34 The Directory Structure of Packages Two major results occur when a class is placed in a package The name of the package becomes a part of the name of the class. The name of the package must match the directory structure where the corresponding bytecode resides. 34

35 Packages and Directories package directory (folder) class file A class named D in package a.b.c should reside in this file: a/b/c/d.class The "root" directory of the package hierarchy is determined by your class path or the directory from which java was run. Package Declaration package name; public class name {... Example: package sample el; public class e1 extends e2 {... } File e2.java should go in folder sample. Video Link: 35

36 A Multithreaded Programming A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs. 36

37 Multithreaded Programming - Thread States A thread can be in one of five states: New, Ready, Running, Blocked, or Finished. Thread created New start() Ready yield(), or time out run() join() Running run() returns 37 Finished Target finished interrupt() sleep() wait() Wait for target to finish Wait for time out Wait to be notified Blocked Time out notify() or notifyall() Interrupted() 37

38 How does a Thread run? The thread class has a run() method run() is executed when the thread's start() method is invoked The thread terminates if the run method terminates To prevent a thread from terminating, the run method must not end run methods often have an endless loop to prevent thread termination One thread starts another by calling its start method The sequence of events can be confusing to those more familiar with a single threaded model. Thread1 start() Thread Object run() Thread2 38

39 The Thread Class 39 «interface» java.lang.runnable java.lang.thread +Thread() +Thread(task: Runnable) +start(): void +isalive(): boolean +setpriority(p: int): void +join(): void +sleep(millis: long): void +yield(): void +interrupt(): void Creates a default thread. Creates a thread for a specified task. Starts the thread that causes the run() method to be invoked by the JVM. Tests whether the thread is currently running. Sets priority p (ranging from 1 to 10) for this thread. Waits for this thread to finish. Puts the runnable object to sleep for a specified time in milliseconds. Causes this thread to temporarily pause and allow other threads to execute. Interrupts this thread. 39

40 Blocking Threads When reading from a stream, if input is not available, the thread will block Thread is suspended ( blocked ) until I/O is available Allows other threads to automatically activate When I/O available, thread wakes back again Becomes runnable Not to be confused with the Runnable interface 40

41 Thread Scheduling In general, the runnable thread with the highest priority is active (running) Java is priority-preemptive If a high-priority thread wakes up, and a low-priority thread is running Then the high-priority thread gets to run immediately Allows on-demand processing -- Efficient use of CPU 41

42 Thread Priorities A Thread inherits the priority of its parent thread. We can increase or decrease the priority of any thread with the setprioritymethod. We can set the priority to any value between MIN_PRIORITY (0) and MAX_PRIORITY (10). NORM_PRIORITY is defined as 5. 42

43 Thread Synchronization When more than one thread try to access a shared resource, resource will be used by only one thread at a time. The process by which this is achieved is called synchronization. The synchronization keyword in Java creates a block of code referred to as critical section. 43

44 Thread Synchronization class Table{ void printtable(int n){//method not synchronized for(int i=1;i<=5;i++){ System.out.println(n*i); try{ Thread.sleep(400); }catch(exception e){system.out.println(e);} } } } class MyThread1 extends Thread{ Table t; MyThread1(Table t){ this.t=t; } public void run(){ t.printtable(5); } } class MyThread2 extends Thread{ Table t; MyThread2(Table t){ this.t=t; } public void run(){ t.printtable(100); } } class TestSynchronization1{ public static void main(string args[]){ Table obj = new Table();//only one object MyThread1 t1=new MyThread1(obj); MyThread2 t2=new MyThread2(obj); t1.start(); t2.start(); } } 44

45 Implementing the Runnable Interface By implementing Runnable interface, we need to provide implementation for run() method. To run this implementation class, create a Thread object, pass Runnable implementation class object to its constructor. 45

46 UNIT IV -- Managing Errors and Exceptions -- Syntax of Exception Handling Code -- Using Finally Statement -- Throwing Our Own Exceptions -- Applet Programming, Applet Life Cycle -- Graphics Programming -- Managing Input/Output Files -- Stream Classes -- Byte Stream Classes -- Character Stream Classes -- Using the File Class, Random Access Files -- Other Stream Classes 46

47 Exceptions and Errors When a problem encounters and unexpected termination or fault, it is called an exception When we try and divide by 0 we terminate abnormally. Exception handling gives us another opportunity to recover from the abnormality. Situations from which we cannot recover like Out of memory are considered as errors. 47

48 JAVA Exception Hierarchy 48

49 Exception Handling /** Set a new radius */ public void setradius(double newradius) throws IllegalArgumentException { if (newradius >= 0) radius = newradius; else throw new IllegalArgumentException("Radius cannot be negative"); } try { statements; // Statements that may throw exceptions } catch (Exception1 exvar1) { handler for exception1; } catch (Exception2 exvar2) { handler for exception2; }... catch (ExceptionN exvar3) { handler for exceptionn; } 49

50 JAVA Applets Java applications Run in stand-alone mode No additional software required Java applets Compiled Java class files Run within a Web browser (or an appletviewer) Loaded from anywhere on the Internet security restrictions 50

51 Applet Life Cycle When an applet begins the following sequence of methods is called init() informs applet that it has been loaded into the system Called only once an ideal place to initialize variables and create UI objects start() informs applet that it should start its execution Right after init() Each time the page is loaded and restarted When an applet dies (or is terminated), the following sequence of method calls takes place: stop() informs applet that it should stop its execution When a web browser leaves the HTML document 51

52 JAVA Coordinate System Component Hierarchy Each component has its own subwindow Subwindow = rectangular area within parent component Has own coordinate system Clipping: Can t paint outside its subwindow Can t paint over child components. 52

53 Graphics Primitives Point (x,y) Line (pt1,pt2) PolyLine (pt list) Arc Oval (pt, w,h) Rectangle (pt, w,h) RoundRectangle Polygon (pt list) Image (file, x,y) Text (string, x,y) Draw label Fill 53

54 Graphics Methods drawstring(string, left, bottom) Draws a string in the current font and color with the bottom left corner of the string at the specified location One of the few methods where the y coordinate refers to the bottom of shape, not the top. But y values are still with respect to the top left corner of the applet window drawrect(left, top, width, height) Draws the outline of a rectangle (1-pixel border) in the current color fillrect(left, top, width, height) Draws a solid rectangle in the current color drawline(x1, y1, x2, y2) Draws a 1-pixel-thick line from (x1, y1) to (x2, y2) 54

55 Graphics Methods drawoval, filloval Draws an outlined and solid oval, where the arguments describe a rectangle that bounds the oval. drawpolygon, fillpolygon Draws an outlined and solid polygon whose points are defined by arrays or a Polygon (a class that stores a series of points) By default, polygon is closed; to make an open polygon use the drawpolyline method. drawimage Draws an image Images can be in JPEG or GIF (including GIF89A) format Video Link: 55

56 Concept of Streams A stream can be defined as a sequence of data. InputStream: The InputStream is used to read data from a source. OutPutStream: the OutputStream is used for writing data to a destination. 56

57 JAVA Stream Classes Stream classes is java is used for reading and writing data. The Java Stream Classes are the part of java.io. 57

58 Character Stream and Byte Stream Classes in JAVA 58

59 Random Access Files Random access files are files in which records can be accessed in any order Also called direct access files More efficient than sequential access files 59

60 Input Output Streams in JAVA The InputStream is used to read data from a source file. The OutputStream is used for writing data to a destination file. 60

61 UNIT V -- Network basics -- Socket programming -- Proxy servers -- TCP/IP -- Net Address -- URL, Datagrams -- Java Utility Classes -- Introducing the AWT -- Working with Windows, Graphics and Text- AWT Classes -- Working with Frames, Working with Graphics, -- Working with Color, Working with Fonts -- Using AWT Controls, Layout Managers and Menus 61

62 Network Programming Mechanisms by which software running on two or more computational devices can exchange messages. Java is a network centric programming language. Java abstracts details of network implementation behind a standard API. Applications Application Protocols Streams Unicast Broadcast Datagrams Multicast Addressing & Routing Physical Transport 62

63 Socket Programming with TCP The application developer has the ability to fix a few TCP parameters, such as maximum buffer and maximum segment sizes. Video Link: 63

64 JAVA Socket Programming Sockets provide the communication between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. When the connection is made, the server creates a socket object on its end of the communication. 64

65 Mechanism of Proxy Server A proxy is a host which relays web access requests from clients. Used when clients do not access the web directly Used for security, logging, accounting and performance 65

66 JAVA Utility Classes Java.util package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes. 66

67 JAVA AWT Component Java AWT (Abstract Window Toolkit) is an API to develop GUI or windowbased applications in java. Java AWT components are platform-dependent. AWT is heavyweight components. 67

68 Working with Frames A frame, implemented as an instance of the JFrame class, is a window that has decorations such as a border, a title, and supports button components that close or iconify the window. 68

69 Working with Colors in JAVA The Color class states colors in default RGB color space. Class declaration for java.awt.color class: public class Color extends Object implements Paint, Serializable 69

70 JAVA Fonts 70

71 JAVA LayoutManager Layout manager automatically positions the components within container. The layout manager is associated with every Container object. Each layout manager is an object of the class that implements the Layout Manager interface. 71

72 Java LayoutManagers LayoutManager is an interface that is implemented by all the classes of layout managers. There are following classes that represents the layout managers: java.awt.borderlayout java.awt.flowlayout java.awt.gridlayout java.awt.cardlayout java.awt.gridbaglayout javax.swing.boxlayout javax.swing.grouplayout javax.swing.scrollpanelayout javax.swing.springlayout 72

73 Example of BorderLayout class: import java.awt.*; import javax.swing.*; public class Border { JFrame f; Border(){ f=new JFrame(); JButton b1=new JButton("NORTH");; JButton b2=new JButton("SOUTH");; JButton b3=new JButton("EAST");; JButton b4=new JButton("WEST");; JButton b5=new JButton("CENTER");; f.add(b1,borderlayout.north); f.add(b2,borderlayout.south); f.add(b3,borderlayout.east); f.add(b4,borderlayout.west); f.add(b5,borderlayout.center); f.setsize(300,300); f.setvisible(true); } public static void main(string[] args) { new Border(); } } Output: 73

74 Java JMenuBar, JMenu and JMenuItem The JMenuBar class is used to display menubar on the window or frame Menu and MenuItem controls are subclass of MenuComponent class. JMenuBar class declaration public class JMenuBar extends JComponent implements MenuElement, Accessible JMenu class declaration public class JMenu extends JMenuItem implements MenuElement, Accessible JMenuItem class declaration public class JMenuItem extends AbstractButton implements Accessible, MenuElement SAZ4A Programming in JAVA 74

75 import javax.swing.*; class MenuExample { JMenu menu, submenu; JMenuItem i1, i2, i3, i4, i5; MenuExample(){ JFrame f= new JFrame("Menu and MenuItem Example"); JMenuBar mb=new JMenuBar(); menu=new JMenu("Menu"); submenu=new JMenu("Sub Menu"); i1=new JMenuItem("Item 1"); i2=new JMenuItem("Item 2"); i3=new JMenuItem("Item 3"); i4=new JMenuItem("Item 4"); i5=new JMenuItem("Item 5"); menu.add(i1); menu.add(i2); menu.add(i3); submenu.add(i4); submenu.add(i5); menu.add(submenu); mb.add(menu); f.setjmenubar(mb); f.setsize(400,400); f.setlayout(null); f.setvisible(true); } public static void main(string args[]) { new MenuExample(); }} Output: SAZ4A Programming in JAVA 1 / 75

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries 1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads

More information

15CS45 : OBJECT ORIENTED CONCEPTS

15CS45 : OBJECT ORIENTED CONCEPTS 15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?

More information

UNIT IV MULTITHREADING AND GENERIC PROGRAMMING

UNIT IV MULTITHREADING AND GENERIC PROGRAMMING UNIT IV MULTITHREADING AND GENERIC PROGRAMMING Differences between multithreading and multitasking, thread life cycle, creating threads, creating threads, synchronizing threads, Inter-thread communication,

More information

SELF-STUDY. Glossary

SELF-STUDY. Glossary SELF-STUDY 231 Glossary HTML (Hyper Text Markup Language - the language used to code web pages) tags used to embed an applet. abstract A class or method that is incompletely defined,

More information

Core JAVA Training Syllabus FEE: RS. 8000/-

Core JAVA Training Syllabus FEE: RS. 8000/- About JAVA Java is a high-level programming language, developed by James Gosling at Sun Microsystems as a core component of the Java platform. Java follows the "write once, run anywhere" concept, as it

More information

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc.,CST Semester / Year : EVEN / III Subject Name

More information

Multithreaded Programming

Multithreaded Programming Multithreaded Programming Multithreaded programming basics Concurrency is the ability to run multiple parts of the program in parallel. In Concurrent programming, there are two units of execution: Processes

More information

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B Contents About the Course...xv Course Overview... xvi Course Map... xvii Module-by-Module Overview... xviii Course Objectives... xxii Skills Gained by Module... xxiii Guidelines for Module Pacing... xxiv

More information

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

Object Oriented Programming with Java. Unit-1

Object Oriented Programming with Java. Unit-1 CEB430 Object Oriented Programming with Java Unit-1 PART A 1. Define Object Oriented Programming. 2. Define Objects. 3. What are the features of Object oriented programming. 4. Define Encapsulation and

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling Multithreaded Programming Topics Multi Threaded Programming What are threads? How to make the classes threadable; Extending threads;

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

SCHEME OF COURSE WORK

SCHEME OF COURSE WORK SCHEME OF COURSE WORK Course Details: Course Title Object oriented programming through JAVA Course Code 15CT1109 L T P C : 3 0 0 3 Program: B.Tech. Specialization: Information Technology Semester IV Prerequisites

More information

OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70

OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3 Hours Full Marks: 70 I,.. CI/. T.cH/C8E/ODD SEM/SEM-5/CS-504D/2016-17... AiIIIII "-AmI u...iir e~ IlAULAKA ABUL KALAM AZAD UNIVERSITY TECHNOLOGY,~TBENGAL Paper Code: CS-504D OF OBJECT ORIENTED PROGRAMMING TYm. Allotted : 3

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

1 OBJECT-ORIENTED PROGRAMMING 1

1 OBJECT-ORIENTED PROGRAMMING 1 PREFACE xvii 1 OBJECT-ORIENTED PROGRAMMING 1 1.1 Object-Oriented and Procedural Programming 2 Top-Down Design and Procedural Programming, 3 Problems with Top-Down Design, 3 Classes and Objects, 4 Fields

More information

S.E. Sem. III [CMPN] Object Oriented Programming Methodology

S.E. Sem. III [CMPN] Object Oriented Programming Methodology S.E. Sem. III [CMPN] Object Oriented Programming Methodology Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 80 Q.1(a) Write a program to calculate GCD of two numbers in java. [5] (A) import java.util.*;

More information

7. MULTITHREDED PROGRAMMING

7. MULTITHREDED PROGRAMMING 7. MULTITHREDED PROGRAMMING What is thread? A thread is a single sequential flow of control within a program. Thread is a path of the execution in a program. Muti-Threading: Executing more than one thread

More information

Character Stream : It provides a convenient means for handling input and output of characters.

Character Stream : It provides a convenient means for handling input and output of characters. Be Perfect, Do Perfect, Live Perfect 1 1. What is the meaning of public static void main(string args[])? public keyword is an access modifier which represents visibility, it means it is visible to all.

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus PESIT Bangalore South Campus 15CS45 : OBJECT ORIENTED CONCEPTS Faculty : Prof. Sajeevan K, Prof. Hanumanth Pujar Course Description: No of Sessions: 56 This course introduces computer programming using

More information

Unit - IV Multi-Threading

Unit - IV Multi-Threading Unit - IV Multi-Threading 1 Uni Processing In the early days of computer only one program will occupy the memory. The second program must be in waiting. The second program will be entered whenever first

More information

Le L c e t c ur u e e 7 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Multithreading

Le L c e t c ur u e e 7 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Multithreading Course Name: Advanced Java Lecture 7 Topics to be covered Multithreading Thread--An Introduction Thread A thread is defined as the path of execution of a program. It is a sequence of instructions that

More information

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B 1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these 2. How many primitive data types are there in Java? A. 5 B. 6 C. 7 D. 8 3. In Java byte, short, int and long

More information

ABOUT CORE JAVA COURSE SCOPE:

ABOUT CORE JAVA COURSE SCOPE: ABOUT CORE JAVA COURSE SCOPE: JAVA based business programs perform well because constant JAVA requirements help designers to create multilevel programs with a component centered approach. JAVA growth allows

More information

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5

Objective Questions. BCA Part III Paper XIX (Java Programming) page 1 of 5 Objective Questions BCA Part III page 1 of 5 1. Java is purely object oriented and provides - a. Abstraction, inheritance b. Encapsulation, polymorphism c. Abstraction, polymorphism d. All of the above

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introducing Object Oriented Programming... 2 Explaining OOP concepts... 2 Objects...3

More information

Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering. Fifth Semester

Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering. Fifth Semester Govt. of Karnataka, Department of Technical Education Diploma in Information Science & Engineering Fifth Semester Subject: Programming With Java Contact Hrs / week: 4 Total hrs: 64 Table of Contents SN

More information

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets

Road Map. Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Java Applets Road Map Introduction to Java Applets Review applets that ship with JDK Make our own simple applets Introduce inheritance Introduce the applet environment html needed for applets Reading:

More information

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have)

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have) Overview: Java programming language is developed by Sun Microsystems. Java is object oriented, platform independent, simple, secure, architectural neutral, portable, robust, multi-threaded, high performance,

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Mobile MOUSe JAVA2 FOR PROGRAMMERS ONLINE COURSE OUTLINE

Mobile MOUSe JAVA2 FOR PROGRAMMERS ONLINE COURSE OUTLINE Mobile MOUSe JAVA2 FOR PROGRAMMERS ONLINE COURSE OUTLINE COURSE TITLE JAVA2 FOR PROGRAMMERS COURSE DURATION 14 Hour(s) of Interactive Training COURSE OVERVIEW With the Java2 for Programmers course, anyone

More information

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform Outline Introduction to Java Introduction Java 2 Platform CS 3300 Object-Oriented Concepts Introduction to Java 2 What Is Java? History Characteristics of Java History James Gosling at Sun Microsystems

More information

CS 556 Distributed Systems

CS 556 Distributed Systems CS 556 Distributed Systems Tutorial on 4 Oct 2002 Threads A thread is a lightweight process a single sequential flow of execution within a program Threads make possible the implementation of programs that

More information

CIS233J Java Programming II. Threads

CIS233J Java Programming II. Threads CIS233J Java Programming II Threads Introduction The purpose of this document is to introduce the basic concepts about threads (also know as concurrency.) Definition of a Thread A thread is a single sequential

More information

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

The Sun s Java Certification and its Possible Role in the Joint Teaching Material The Sun s Java Certification and its Possible Role in the Joint Teaching Material Nataša Ibrajter Faculty of Science Department of Mathematics and Informatics Novi Sad 1 Contents Kinds of Sun Certified

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Contents. 6-1 Copyright (c) N. Afshartous

Contents. 6-1 Copyright (c) N. Afshartous Contents 1. Classes and Objects 2. Inheritance 3. Interfaces 4. Exceptions and Error Handling 5. Intro to Concurrency 6. Concurrency in Java 7. Graphics and Animation 8. Applets 6-1 Copyright (c) 1999-2004

More information

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7) Software Development & Education Center Java Platform, Standard Edition 7 (JSE 7) Detailed Curriculum Getting Started What Is the Java Technology? Primary Goals of the Java Technology The Java Virtual

More information

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance?

CS Internet programming Unit- I Part - A 1 Define Java. 2. What is a Class? 3. What is an Object? 4. What is an Instance? CS6501 - Internet programming Unit- I Part - A 1 Define Java. Java is a programming language expressly designed for use in the distributed environment of the Internet. It was designed to have the "look

More information

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java. [Course Overview] The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming,

More information

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS Core Java SYLLABUS COVERAGE Introduction. OOPS Package Exception Handling. Multithreading Applet, AWT, Event Handling Using NetBean, Ecllipse. Input Output Streams, Serialization Networking Collection

More information

Multithread Computing

Multithread Computing Multithread Computing About This Lecture Purpose To learn multithread programming in Java What You Will Learn ¾ Benefits of multithreading ¾ Class Thread and interface Runnable ¾ Thread methods and thread

More information

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

Handling Multithreading Approach Using Java Nikita Goel, Vijaya Laxmi, Ankur Saxena Amity University Sector-125, Noida UP India

Handling Multithreading Approach Using Java Nikita Goel, Vijaya Laxmi, Ankur Saxena Amity University Sector-125, Noida UP India RESEARCH ARTICLE Handling Multithreading Approach Using Java Nikita Goel, Vijaya Laxmi, Ankur Saxena Amity University Sector-125, Noida UP-201303 - India OPEN ACCESS ABSTRACT This paper contains information

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

G51PRG: Introduction to Programming Second semester Applets and graphics

G51PRG: Introduction to Programming Second semester Applets and graphics G51PRG: Introduction to Programming Second semester Applets and graphics Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Previous two lectures AWT and Swing Creating components and putting

More information

John Cowell. Essential Java Fast. How to write object oriented software for the Internet. with 64 figures. Jp Springer

John Cowell. Essential Java Fast. How to write object oriented software for the Internet. with 64 figures. Jp Springer John Cowell Essential Java Fast How to write object oriented software for the Internet with 64 figures Jp Springer Contents 1 WHY USE JAVA? 1 Introduction 1 What is Java? 2 Is this book for you? 2 What

More information

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. Preface p. xix Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. 5 Java Applets and Applications p. 5

More information

PART1: Choose the correct answer and write it on the answer sheet:

PART1: Choose the correct answer and write it on the answer sheet: PART1: Choose the correct answer and write it on the answer sheet: (15 marks 20 minutes) 1. Which of the following is included in Java SDK? a. Java interpreter c. Java disassembler b. Java debugger d.

More information

Core Java Syllabus. Overview

Core Java Syllabus. Overview Core Java Syllabus Overview Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Chapter 1 Chapter 1 1 Objectives overview computer hardware and software introduce program design and object-oriented programming overview the Java programming language

More information

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content Core Java - SCJP Course content NOTE: For exam objectives refer to the SCJP 1.6 objectives. 1. Declarations and Access Control Java Refresher Identifiers & JavaBeans Legal Identifiers. Sun's Java Code

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

Implementing Graphical User Interfaces

Implementing Graphical User Interfaces Chapter 6 Implementing Graphical User Interfaces 6.1 Introduction To see aggregation and inheritance in action, we implement a graphical user interface (GUI for short). This chapter is not about GUIs,

More information

Methods (Deitel chapter 6)

Methods (Deitel chapter 6) Methods (Deitel chapter 6) 1 Plan 2 Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods

More information

Object Oriented Programming (II-Year CSE II-Sem-R09)

Object Oriented Programming (II-Year CSE II-Sem-R09) (II-Year CSE II-Sem-R09) Unit-VI Prepared By: A.SHARATH KUMAR M.Tech Asst. Professor JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD. (Kukatpally, Hyderabad) Multithreading A thread is a single sequential

More information

Unit 5 - Exception Handling & Multithreaded

Unit 5 - Exception Handling & Multithreaded Exceptions Handling An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/application

More information

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1 Block I Unit 2 Basic Constructs in Java M301 Block I, unit 2 1 Developing a Simple Java Program Objectives: Create a simple object using a constructor. Create and display a window frame. Paint a message

More information

Java Programming Course Overview. Duration: 35 hours. Price: $900

Java Programming Course Overview. Duration: 35 hours. Price: $900 978.256.9077 admissions@brightstarinstitute.com Java Programming Duration: 35 hours Price: $900 Prerequisites: Basic programming skills in a structured language. Knowledge and experience with Object- Oriented

More information

SYLLABUS JAVA COURSE DETAILS. DURATION: 60 Hours. With Live Hands-on Sessions J P I N F O T E C H

SYLLABUS JAVA COURSE DETAILS. DURATION: 60 Hours. With Live Hands-on Sessions J P I N F O T E C H JAVA COURSE DETAILS DURATION: 60 Hours With Live Hands-on Sessions J P I N F O T E C H P U D U C H E R R Y O F F I C E : # 4 5, K a m a r a j S a l a i, T h a t t a n c h a v a d y, P u d u c h e r r y

More information

Unit III Rupali Sherekar 2017

Unit III Rupali Sherekar 2017 Unit III Exceptions An exception is an abnormal condition that arises in a code sequence at run time. In other words, an exception is a run-time error. In computer languages that do not support exception

More information

COURSE 11 PROGRAMMING III OOP. JAVA LANGUAGE

COURSE 11 PROGRAMMING III OOP. JAVA LANGUAGE COURSE 11 PROGRAMMING III OOP. JAVA LANGUAGE PREVIOUS COURSE CONTENT Input/Output Streams Text Files Byte Files RandomAcessFile Exceptions Serialization NIO COURSE CONTENT Threads Threads lifecycle Thread

More information

Animation Part 2: MoveableShape interface & Multithreading

Animation Part 2: MoveableShape interface & Multithreading Animation Part 2: MoveableShape interface & Multithreading MoveableShape Interface In the previous example, an image was drawn, then redrawn in another location Since the actions described above can apply

More information

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Atelier Java - J1. Marwan Burelle.  EPITA Première Année Cycle Ingénieur. marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 3 4 Plan 1 2 3 4 A Bit of History JAVA was created in 1991 by James Gosling of SUN. The first public implementation (v1.0) in 1995.

More information

Chapter 3 - Introduction to Java Applets

Chapter 3 - Introduction to Java Applets 1 Chapter 3 - Introduction to Java Applets 2 Introduction Applet Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language)

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV Contents Preface Chapter 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19

More information

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 1. JIT meaning a. java in time b. just in time c. join in time d. none of above CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY JAVA 2. After the compilation of the java source code, which file is created

More information

20 Most Important Java Programming Interview Questions. Powered by

20 Most Important Java Programming Interview Questions. Powered by 20 Most Important Java Programming Interview Questions Powered by 1. What's the difference between an interface and an abstract class? An abstract class is a class that is only partially implemented by

More information

Methods (Deitel chapter 6)

Methods (Deitel chapter 6) 1 Plan 2 Methods (Deitel chapter ) Introduction Program Modules in Java Math-Class Methods Method Declarations Argument Promotion Java API Packages Random-Number Generation Scope of Declarations Methods

More information

1.0 Libraries Technical Overview

1.0 Libraries Technical Overview 1.0 Libraries Technical Overview Jonni Kanerva Frank Yellin JavaSoft Outline Introduction Functionality in the 1.0 Libraries Distributed design of the Java platform Instructive oddities Design patterns

More information

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An

More information

Chapter 1 Introduction to Java

Chapter 1 Introduction to Java What is Java? Chapter 1 Introduction to Java Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows,

More information

A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p.

A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p. A Quick Tour p. 1 Getting Started p. 1 Variables p. 3 Comments in Code p. 6 Named Constants p. 6 Unicode Characters p. 8 Flow of Control p. 9 Classes and Objects p. 11 Creating Objects p. 12 Static or

More information

Chapter 12 Exception Handling and Text IO. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited

Chapter 12 Exception Handling and Text IO. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited Chapter 12 Exception Handling and Text IO Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited 2015 1 Motivations When a program runs into a runtime error,

More information

CS335 Graphics and Multimedia

CS335 Graphics and Multimedia CS335 Graphics and Multimedia Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington, KY 40506-0046 -2-1. Programming Using JAVA JAVA history: WHY JAVA? Simple Objected-oriented

More information

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)

CS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question) CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

27/04/2012. We re going to build Multithreading Application. Objectives. MultiThreading. Multithreading Applications. What are Threads?

27/04/2012. We re going to build Multithreading Application. Objectives. MultiThreading. Multithreading Applications. What are Threads? Objectives MultiThreading What are Threads? Interrupting threads Thread properties By Võ Văn Hải Faculty of Information Technologies Summer 2012 Threads priorities Synchronization Callables and Futures

More information

CS8392 OBJECT ORIENTED PROGRAMMING

CS8392 OBJECT ORIENTED PROGRAMMING UNIT I PART A 1. Define classes in java A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of

More information

Java Threads. Introduction to Java Threads

Java Threads. Introduction to Java Threads Java Threads Resources Java Threads by Scott Oaks & Henry Wong (O Reilly) API docs http://download.oracle.com/javase/6/docs/api/ java.lang.thread, java.lang.runnable java.lang.object, java.util.concurrent

More information

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Graphics. Lecture 18 COP 3252 Summer June 6, 2017 Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple

More information

Java Application Development

Java Application Development A Absolute Size and Position - Specifying... 10:18 Abstract Class... 5:15 Accessor Methods...4:3-4:4 Adding Borders Around Components... 10:7 Adding Components to Containers... 10:6 Adding a Non-Editable

More information

Concurrent Programming using Threads

Concurrent Programming using Threads Concurrent Programming using Threads Threads are a control mechanism that enable you to write concurrent programs. You can think of a thread in an object-oriented language as a special kind of system object

More information

Reading from URL. Intent - open URL get an input stream on the connection, and read from the input stream.

Reading from URL. Intent - open URL  get an input stream on the connection, and read from the input stream. Simple Networking Loading applets from the network. Applets are referenced in a HTML file. Java programs can use URLs to connect to and retrieve information over the network. Uniform Resource Locator (URL)

More information

Programming graphics

Programming graphics Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it

More information

Packages: Putting Classes Together

Packages: Putting Classes Together Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic

More information

Chapter 7 Applets. Answers

Chapter 7 Applets. Answers Chapter 7 Applets Answers 1. D The drawoval(x, y, width, height) method of graphics draws an empty oval within a bounding box, and accepts 4 int parameters. The x and y coordinates of the left/top point

More information

Quiz on Tuesday April 13. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 4. Java facts and questions. Things to try in Java

Quiz on Tuesday April 13. CS 361 Concurrent programming Drexel University Fall 2004 Lecture 4. Java facts and questions. Things to try in Java CS 361 Concurrent programming Drexel University Fall 2004 Lecture 4 Bruce Char and Vera Zaychik. All rights reserved by the author. Permission is given to students enrolled in CS361 Fall 2004 to reproduce

More information

Unit - I INTRODUCTION TO OOP AND JAVA FUNDAMENTALS

Unit - I INTRODUCTION TO OOP AND JAVA FUNDAMENTALS Unit - I INTRODUCTION TO OOP AND JAVA FUNDAMENTALS PART-A 1. Define classes in java. A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties

More information

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries

More information

F I N A L E X A M I N A T I O N

F I N A L E X A M I N A T I O N Faculty Of Computer Studies M257 Putting Java to Work F I N A L E X A M I N A T I O N Number of Exam Pages: (including this cover sheet( Spring 2011 April 4, 2011 ( 5 ) Time Allowed: ( 1.5 ) Hours Student

More information

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13 CONTENTS Chapter 1 Getting Started with Java SE 6 1 Introduction of Java SE 6... 3 Desktop Improvements... 3 Core Improvements... 4 Getting and Installing Java... 5 A Simple Java Program... 10 Compiling

More information

9. APPLETS AND APPLICATIONS

9. APPLETS AND APPLICATIONS 9. APPLETS AND APPLICATIONS JAVA PROGRAMMING(2350703) The Applet class What is an Applet? An applet is a Java program that embedded with web content(html) and runs in a Web browser. It runs inside the

More information