Note: Answer any five questions. Sun micro system officially describes java with a list of buzz words
|
|
- Nickolas Johns
- 6 years ago
- Views:
Transcription
1 INTERNAL ASSESSMENT TEST I Date : Max Marks: 50 Subject & Code: JAVA & J2EE (10IS753) Section : A & B Name of faculty: M V Sreenath Time : AM 1.List and Explain features of Java. Note: Answer any five questions Sun micro system officially describes java with a list of buzz words or attributes. They are: - Simple & powerful - Safe - Object oriented - Robust - Architecture neutral - Compiled & Interpreted - Multithreaded - Easy to learn The salient features of Java are as follows: Simple & Powerful: To make the language familiar to the existing programming, java is modeled on C & C++. Java empowers you to express every idea you have in a clean objectoriented way.safe: Threat of viruses and abuse of resources are every where, java system not only verify the memory resources but also ensures that no viruses are communicated with the applet. Theabsence of pointers in java ensures that program can not gain access to memory location.object-oriented: Java is an object-oriented language. Almost every thing in java is object. All the program codes & data reside within object & classes.
2 Robust: Java is a strictly typed language, because the types must match exactly. It checks yourcode at compile time as well as at run time. Java is a garbage collected language, relieving theprogrammers all memory management problems ( i.e., deallocation is completely automatic). Java incorporates exception handling which captures series of errors and eliminates any riskof crashing the system. Architecture neutral: Java is the language that is not tied to any particular hardware or operating system. Program developed in java can be executed anywhere on any system. Youcan write once, run anywhere, anytime forever. Changes & upgrades in operating system, processors will not force any changes in java program. It works on Macintosh PC, UNIX &whatever the future platforms can offer. Interpreted: Java accomplishes architecture neutrality by compiling the java source code intoan intermediate code called byte codes, which can be interpreted on any system that has aproper java runtime on it.multithreaded: Java supports multithreaded programming which allows you to writeprograms that do many things simultaneously. Easy to learn: The language features feel like the natural way to do things & encourage goodprogramming style. Since object model is both mandatory & simple, you will quicklybecome acquainted with object oriented style of programming. BYTE Code is intermediate level code, which is interpreted by the JVM. It is
3 not directly
4 executable on the machine. This gives java it s write once and run anywhere nature. Whenjava program is written and compiled then it will create a.class file which consists of bytecode instructions, understandable to JVM. This class file is system independent. Every system has it s own JVM.so jvm will convert this byte code into machine language understandable to that system. So it has run write once and run anywhere nature. Java achieves architecture neutrality in the following way. Being platform independent wasone of the major objectives for java. Java achieves this independence by introducing anintermediate code representation of compiled java programs. Programs are compiled into abyte code which is then interpreted by platform specific interpreter. The byte code is same forany architecture, IBM compatible, Apple, Sparc, Sun Solaris. 2) a) Explain: i)>>> ii)short circuit logical operators iii)for each 1: : ================================================ : / / Overflow >>> 1 ================================================ : / / Unsigned shift right. Java provides two boolean operators boolean AND and boolean OR which are not provided by the other language and these operators are known as Short-Circuit logical operators. These operators gets the result of an logical operator, evaluating the right hand operator only if required. As per the Boolean Logical Table for a logical AND (&) operation, if the left hand (first) operand is false, then the result is false irrespective of the
5 right hand (second) operand. When short-circuit AND (&&) is used, if the first value is false, second value is not evaluated. Similarly for short-circuit OR ( ), if the first value is true, then second value is not evaluated. These short-circuit operators will be useful when we want to control the evaluation of right hand operand. if( denom!=0 && num / denom > 10 ) Here, the right hand expression num / denom > 10 will be evaluated only when denom is not zero, thus preventing divide by zero ArithmeticException. For-each is another array traversing technique like for loop, while loop, do-while loop introduced in Java5. It starts with the keyword for like a normal for-loop. Instead of declaring and initializing a loop counter variable, you declare a variable that is the same type as the base type of the array, followed by a colon, which is then followed by the array name. In the loop body, you can use the loop variable you created rather than using an indexed array element. It s commonly used to iterate over an array or a Collections class (eg, ArrayList) Syntax: for (type var : array) statements using var; Describe the process of building and running java program. Compiling Java Source Code Before the Java virtual machine (VM) can run a Java program, the program's Java source code must be compiled into byte-code using the javac compiler. Java byte-code is a platform independent version of machine code; the target machine is the Java VM rather than the underlying architecture. To compile a Java source code file Foo.java, you would do the following: % javac -g Foo.java
6 The -g command line option is optional, but we recommend using it as it makes debugging easier. If there are no errors in your source file, the Java compiler will produce one or more.class files (one.class file for each class defined in the Foo.java source file). For example, the results of a successful compile of Foo.java will produce a byte-code version of the class in a file named Foo.class. Every public class that you write must be in a separate.java file where the first part of the file name is identical to the class name. The.java file additionally can contain code for protected and private classes. We suggest that you get in the habit of using makefiles for compiling your Java application code. More information on makefiles is available here. Running a Java application Once you have successfully compiled your Java source code, you can invoke the Java VM to run your application's byte-code: % java <class with main method to run> [<comman d line args>,...] For example, to run the main method from the Foo class: % java Foo Any command line arguments (arguments to Foo's main method) follow the class name: % java Foo ) a) Describe the significance of final and super with examples. Usage of super class Super variables refer to the variable of variable of parent class. Super() invokes the constructor of immediate parent class. Super refers to the method of parent class. class employee int wt = 8; class clerk extends employee int wt = 10; //work time void display()
7 System.out.println(super.wt); //will print work t ime of clerk public static void main(string args[]) clerk c = new clerk(); c.display(); Final is a keyword in Java that is used to restrict the user and can be used in many respects. Final can be used with: Class Methods Variables final class stud // Methods cannot be extended to its sub class class books extends stud void show() System.out.println("Book-Class method"); public static void main(string args[]) books B1 = new books(); B1.show(); class stud final void show() System.out.println("Class - stud : method defined "); class books extends stud void show() System.out.println("Class - books : method define d"); public static void main(string args[]) books B2 = new books(); B2.show();
8 import java.util.*; import java.lang.*; import java.io.*; class stud final int val; stud() val = 60; void method() System.out.println(val); public static void main(string args[]) stud S1 = new stud(); S1.method(); 4)a) What is an inner class? Write a program to demonstrate inner class. b) Explain the java's built in exceptions. Java inner class or nested class is a class which is declared inside the class or interface. We use inner classes to logically group classes and interfaces in one place so that it can be more readable and maintainable. Additionally, it can access all the members of outer class including private data members and methods. Advantage of java inner classes There are basically three advantages of inner classes in java. They are as follows: 1) Nested classes represent a special type of relationship that is it can access all the members (data members and methods) of outer class including private. 2) Nested classes are used to develop more readable and maintainable code because it logically group classes and interfaces in one place only. 3) Code Optimization: It requires less code to write. Built-in exceptions are the exceptions which are available in Java libraries. These exceptions are suitable to explain certain error situations. Below is the list of important built-in exceptions in Java.
9 Arithmetic Exception It is thrown when an exceptional condition has occurred in an arithmetic operation. ArrayIndexOutOfBoundException It is thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array. ClassNotFoundException This Exception is raised when we try to access a class whose definition is not found FileNotFoundException This Exception is raised when a file is not accessible or does not open. IOException It is thrown when an input-output operation failed or interrupted InterruptedException It is thrown when a thread is waiting, sleeping, or doing some processing, and it is interrupted. NoSuchFieldException It is thrown when a class does not contain the field (or variable) specified NoSuchMethodException It is thrown when accessing a method which is not found. NullPointerException This exception is raised when referring to the members of a null object. Null represents nothing 5)What is a package? What are the steps involved in creating user defined packages? package is a keyword of Java followed by the package name. Just writing the package statement followed by the name creates a new package; see how simple Java is to practice. For this reason, Java is known as a production language. While create User Defined Packages Java, the order of statements is very important. The order must be like this, else, compilation error. 1. Package statement 2. Import statement 3. Class declaration
10 If exists, the package statement must be first one in the program. If exists, the import statement must be the second one. Our class declaration is the third. Any order changes, it is a compilation error. When the code is ready, the next job is compilation. We must compile with package notation. Package notation uses d compiler option as follows. C:\snr > javac -d. Tiger.java The d compiler option creates a new folder called forest and places the Tiger.class in it. The dot (.) is an operating system's environment variable that indicates the current directory. It is an instruction to the OS to create a directory called forest and place the Tiger.class in it. 6)a) How are arrays defined and used in java. b) Discuss labeled break and continue statements. Syntax arrayrefvar = new datatype[arraysize]; The above statement does two things It creates an array using new datatype[arraysize]. It assigns the reference of the newly created array to the variable arrayrefvar. Declaring an array variable, creating an array, and assigning the reference of the array to the variable can be combined in one statement, as shown below datatype[] arrayrefvar = new datatype[arraysize]; Alternatively you can create arrays as follows datatype[] arrayrefvar = value0, value1,..., valu ek; The array elements are accessed through the index. Array indices are 0-based; that is, they start from 0 to arrayrefvar.length-1. Example Following statement declares an array variable, mylist, creates an array of 10 elements of double type and assigns its reference to mylist double[] mylist = new double[10];
11 Using break statement : When a break statement is encountered inside a loop, the loop is terminated and program control resumes at the next statement following the loop. Here is a simple example: /** * This program demonstrates * break to exit a loop. */ public class BreakDemo public static void main(string[] args) for (int i = 1; i <= 10; i++) if (i == 5) break; // terminate loop if i is 5 System.out.print(i + " "); System.out.println("Loop is over."); b) What is meant by instance variable hiding? How to overcome it? 7)What is an exception? Explain the different exception handling mechanisms with an example This is the general form of an exception-handling block: try //block of code to be monitored for errors catch (ExceptionType1 exob ) //exception handler for ExceptionType1
12 catch (ExceptionType2 exob ) //exception handler for ExceptionType2
13 //... finally //block of code to be executed before try block ends DIVIDE-BY-ZERO EXCEPTION This small program has an expression that causes a divideby-zero error. class DivideByZero public static void main (String args[]) int d = 0; int a = 42 / d; The Java run-time system constructs a new exception object when it detects an attempt to divide-by-zero. It then throws this exception. In the above example, there is no exceptional handler to catch the exception. The default handler provided by the Java run-time system will process any exception that is not caught by a program. The output of the above program when
14 executed by the standard Java JDK runtime interpreter: java.lang.arithemeticexception:/ by zero at DivideByZero.main(DivideByZero.java:4) Although the default exception handler is provided by Java run-time system, you will usually like to handle exception yourself. The following program includes a try block and a catch clause, which processes the ArithmeticException generated by the divisionby-zero: class DivideByZero public static void main (String args[]) int d, a; try //monitor a block of code d = 0; a = 42 / d; System.out.println("This will not be printed. "); catch(arithmeticexception e) System.out.println("Division by zero.");
15
16 USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Information Science and Engineering System.out.println("After catch statement."); This program generates the following output: Division by zero. After catch statement The call to println() inside the try block is never executed.once an exception is thrown, program control transfers out of the try block into the catch block. Once the catch statement has executed, the program continues with the next line in the program following the entire try/ catch mechanism. 8) a) Differentiate between the usage of access specifiers in java and their scope. b) With an example explain overloading and overriding. Java provides 3 types of access specifiers. public: public keyword applied to a class, makes it available/visible everywhere. Applied to a method or variable, completely B.E VII semester
17 USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Information Science and Engineering visible. Example: public int number; public void sum( ). private: private fields or methods for a class only visible within that class. Private members are not visible within subclasses, and are not inherited. protected: protected members of a class are visible within the class, subclasses and also within all classes that are in the same package as that class and also to subclasses in other packages. friendly(default): when no access modifier is specified, the members defaults to friendly level of access. It makes fields visible within the class, subclasses and also within all classes that are in the same package as that class. b) With an example explain overloading and overriding. Overloading vs Overriding in Java 1. Overloading happens at compile-time while Overriding happens at runtime: The binding of overloaded method call to its definition has happens at B.E VII semester
18 USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Information Science and Engineering compile-time however binding of overridden method call to its definition happens at runtime. 2. Static methods can be overloaded which means a class can have more than one static method of same name. Static methods cannot be overridden, even if you declare a same static method in child class it has nothing to do with the same method of parent class. 3. The most basic difference is that overloading is being done in the same class while for overriding base and child classes are required. Overriding is all about giving a specific implementation to the inherited method of parent class. 4. Static binding is being used for overloaded methods and dynamic binding is being used for overridden/overriding methods. 5. Performance: Overloading gives better performance compared to overriding. The reason is that the binding of overridden methods is being done at runtime. 6. private and final methods can be overloaded but they cannot be overridden. It means a class can have more than one private/final methods of same name but a child class cannot override the private/final methods of their base class. 7. Return type of method does not matter in case of method overloading, it can be same or different. However in case of method overriding the overriding method can have more specific return type 8. Argument list should be different while doing method overloading. Argument list should be same in method Overriding. B.E VII semester
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 informationDOWNLOAD 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 informationWeiss 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 informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationIntroduction 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 information1 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 informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 2
CS321 Languages and Compiler Design I Winter 2012 Lecture 2 1 A (RE-)INTRODUCTION TO JAVA FOR C++/C PROGRAMMERS Why Java? Developed by Sun Microsystems (now Oracle) beginning in 1995. Conceived as a better,
More informationPESIT 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 informationCrash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++
Crash Course in Java Netprog: Java Intro 1 Why Java? Network Programming in Java is very different than in C/C++ much more language support error handling no pointers! (garbage collection) Threads are
More informationIntroduction. Exceptions: An OO Way for Handling Errors. Common Runtime Errors. Error Handling. Without Error Handling Example 1
Exceptions: An OO Way for Handling Errors Introduction Rarely does a program runs successfully at its very first attempt. It is common to make mistakes while developing as well as typing a program. Such
More informationCSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige
CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors
More informationStd 12 Lesson-10 Exception Handling in Java ( 1
Ch-10 : Exception Handling in Java 1) It is usually understood that a compiled program is error free and will always successfully. (a) complete (b) execute (c) perform (d) accomplish 2) In few cases a
More informationAssoc. Prof. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Marenglen Biba Exception handling Exception an indication of a problem that occurs during a program s execution. The name exception implies that the problem occurs infrequently. With exception
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and
More informationException Handling. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions
More informationException Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes
More informationSTRUCTURING OF PROGRAM
Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the
More informationLe L c e t c ur u e e 5 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 Exception Handling
Course Name: Advanced Java Lecture 5 Topics to be covered Exception Handling Exception HandlingHandlingIntroduction An exception is an abnormal condition that arises in a code sequence at run time A Java
More informationCHETTINAD 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 informationCS/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 informationCOP 3330 Final Exam Review
COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationBBM 102 Introduction to Programming II Spring Exceptions
BBM 102 Introduction to Programming II Spring 2018 Exceptions 1 Today What is an exception? What is exception handling? Keywords of exception handling try catch finally Throwing exceptions throw Custom
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationIntroduction 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 informationJava 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 informationCS 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 informationJava Programming. MSc Induction Tutorials Stefan Stafrace PhD Student Department of Computing
Java Programming MSc Induction Tutorials 2011 Stefan Stafrace PhD Student Department of Computing s.stafrace@surrey.ac.uk 1 Tutorial Objectives This is an example based tutorial for students who want to
More informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationChapter 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 informationLecture 20. Java Exceptional Event Handling. Dr. Martin O Connor CA166
Lecture 20 Java Exceptional Event Handling Dr. Martin O Connor CA166 www.computing.dcu.ie/~moconnor Topics What is an Exception? Exception Handler Catch or Specify Requirement Three Kinds of Exceptions
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationArgument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.
Local Variable Initialization Unlike instance vars, local vars must be initialized before they can be used. Eg. void mymethod() { int foo = 42; int bar; bar = bar + 1; //compile error bar = 99; bar = bar
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationModern Programming Languages. Lecture Java Programming Language. An Introduction
Modern Programming Languages Lecture 27-30 Java Programming Language An Introduction 107 Java was developed at Sun in the early 1990s and is based on C++. It looks very similar to C++ but it is significantly
More informationObject Oriented Programming Exception Handling
Object Oriented Programming Exception Handling Budditha Hettige Department of Computer Science Programming Errors Types Syntax Errors Logical Errors Runtime Errors Syntax Errors Error in the syntax of
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Version of February 23, 2013 Abstract Handling errors Declaring, creating and handling exceptions
More informationJAVA MOCK TEST JAVA MOCK TEST III
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationCS260 Intro to Java & Android 03.Java Language Basics
03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance
More informationFull file at Chapter 2 - Inheritance and Exception Handling
Chapter 2 - Inheritance and Exception Handling TRUE/FALSE 1. The superclass inherits all its properties from the subclass. ANS: F PTS: 1 REF: 76 2. Private members of a superclass can be accessed by a
More informationCorrectness and Robustness
Correctness and Robustness 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Introduction
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Version of February 23, 2013 Abstract Handling errors Declaring, creating and handling exceptions
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationSyllabus & 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 informationAnswer1. Features of Java
Govt Engineering College Ajmer, Rajasthan Mid Term I (2017-18) Subject: PJ Class: 6 th Sem(IT) M.M:10 Time: 1 hr Q1) Explain the features of java and how java is different from C++. [2] Q2) Explain operators
More informationContents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix
PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring
More informationZhifu 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 information5/23/2015. Core Java Syllabus. VikRam ShaRma
5/23/2015 Core Java Syllabus VikRam ShaRma Basic Concepts of Core Java 1 Introduction to Java 1.1 Need of java i.e. History 1.2 What is java? 1.3 Java Buzzwords 1.4 JDK JRE JVM JIT - Java Compiler 1.5
More informationChapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management
More informationJava: introduction to object-oriented features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationOutline. 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 informationS.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics
S.No Question Blooms Level Course Outcome UNIT I. Programming Language Syntax and semantics 1 What do you mean by axiomatic Knowledge C254.1 semantics? Give the weakest precondition for a sequence of statements.
More informationObject-Oriented Programming
Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object
More informationLecture 1: Overview of Java
Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationCS506 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 information2 rd class Department of Programming. OOP with Java Programming
1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach
More informationBBM 102 Introduction to Programming II Spring 2017
BBM 102 Introduction to Programming II Spring 2017 Exceptions Instructors: Ayça Tarhan, Fuat Akal, Gönenç Ercan, Vahid Garousi Today What is an exception? What is exception handling? Keywords of exception
More informationException Handling in Java. An Exception is a compile time / runtime error that breaks off the
Description Exception Handling in Java An Exception is a compile time / runtime error that breaks off the program s execution flow. These exceptions are accompanied with a system generated error message.
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationIntroduction to Java Written by John Bell for CS 342, Spring 2018
Introduction to Java Written by John Bell for CS 342, Spring 2018 Based on chapters 1 to 6 of Learning Java by Patrick Niemeyer and Daniel Leuck, with additional material from other sources. History I
More informationJava Interview Questions
Java Interview Questions Dear readers, these Java Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject
More informationJava Overview An introduction to the Java Programming Language
Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/
More informationSCHEME 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 informationHere is a hierarchy of classes to deal with Input and Output streams.
PART 15 15. Files and I/O 15.1 Reading and Writing Files A stream can be defined as a sequence of data. The InputStream is used to read data from a source and the OutputStream is used for writing data
More informationSri Vidya College of Engineering & Technology
UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the
More informationCore Java Interview Questions and Answers.
Core Java Interview Questions and Answers. Q: What is the difference between an Interface and an Abstract class? A: An abstract class can have instance methods that implement a default behavior. An Interface
More informationCS 61B Data Structures and Programming Methodology. July 7, 2008 David Sun
CS 61B Data Structures and Programming Methodology July 7, 2008 David Sun Announcements You ve started (or finished) project 1, right? Package Visibility public declarations represent specifications what
More informationUnit 4 - Inheritance, Packages & Interfaces
Inheritance Inheritance is the process, by which class can acquire the properties and methods of its parent class. The mechanism of deriving a new child class from an old parent class is called inheritance.
More informationCSCI Object Oriented Design: Java Review Errors George Blankenship. Java Review - Errors George Blankenship 1
CSCI 6234 Object Oriented Design: Java Review Errors George Blankenship Java Review - Errors George Blankenship 1 Errors Exceptions Debugging Java Review Topics Java Review - Errors George Blankenship
More informationExceptions, Case Study-Exception handling in C++.
PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case
More informationCSCI Object-Oriented Design. Java Review Topics. Program Errors. George Blankenship 1. Java Review Errors George Blankenship
CSCI 6234 Object Oriented Design: Java Review Errors George Blankenship George Blankenship 1 Errors Exceptions Debugging Java Review Topics George Blankenship 2 Program Errors Types of errors Compile-time
More informationObject Oriented Programming
Object Oriented Programming Java lecture (10.1) Exception Handling 1 Outline Exception Handling Mechanisms Exception handling fundamentals Exception Types Uncaught exceptions Try and catch Multiple catch
More informationIntroduction to Java https://tinyurl.com/y7bvpa9z
Introduction to Java https://tinyurl.com/y7bvpa9z Eric Newhall - Laurence Meyers Team 2849 Alumni Java Object-Oriented Compiled Garbage-Collected WORA - Write Once, Run Anywhere IDE Integrated Development
More informationEXCEPTION HANDLING. Summer 2018
EXCEPTION HANDLING Summer 2018 EXCEPTIONS An exception is an object that represents an error or exceptional event that has occurred. These events are usually errors that occur because the run-time environment
More informationObject Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.
CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java
More informationCourse Status Polymorphism Containers Exceptions Midterm Review. CS Java. Introduction to Java. Andy Mroczkowski
CS 190 - Java Introduction to Java Andy Mroczkowski uamroczk@cs.drexel.edu Department of Computer Science Drexel University February 11, 2008 / Lecture 4 Outline Course Status Course Information & Schedule
More informationB2.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 informationB2.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 informationHistory of Java. Java was originally developed by Sun Microsystems star:ng in This language was ini:ally called Oak Renamed Java in 1995
Java Introduc)on History of Java Java was originally developed by Sun Microsystems star:ng in 1991 James Gosling Patrick Naughton Chris Warth Ed Frank Mike Sheridan This language was ini:ally called Oak
More informationCMSC 331 Second Midterm Exam
1 20/ 2 80/ 331 First Midterm Exam 11 November 2003 3 20/ 4 40/ 5 10/ CMSC 331 Second Midterm Exam 6 15/ 7 15/ Name: Student ID#: 200/ You will have seventy-five (75) minutes to complete this closed book
More informationUnit 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 informationOBJECT 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 informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationMultitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multit
Threads Multitasking Multitasking allows several activities to occur concurrently on the computer. A distinction is usually made between: Process-based multitasking Thread-based multitasking Multitasking
More informationChapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved.
Chapter 9 Exception Handling Copyright 2016 Pearson Inc. All rights reserved. Last modified 2015-10-02 by C Hoang 9-2 Introduction to Exception Handling Sometimes the best outcome can be when nothing unusual
More informationCharacter 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 informationFundamentals of Object Oriented Programming
INDIAN INSTITUTE OF TECHNOLOGY ROORKEE Fundamentals of Object Oriented Programming CSN- 103 Dr. R. Balasubramanian Associate Professor Department of Computer Science and Engineering Indian Institute of
More informationUnit 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 informationCS115. Chapter 17 Exception Handling. Prof. Joe X. Zhou Department of Computer Science. To know what is exception and what is exception handling
CS115 Pi Principles i of fcomputer Science Chapter 17 Exception Handling Prof. Joe X. Zhou Department of Computer Science CS115 ExceptionHandling.1 Objectives in Exception Handling To know what is exception
More informationJava-Array. This tutorial introduces how to declare array variables, create arrays, and process arrays using indexed variables.
-Array Java provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful
More information엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED
엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Questionnaire Results - Java Overview - Java Examples
More informationCOE318 Lecture Notes Week 10 (Nov 7, 2011)
COE318 Software Systems Lecture Notes: Week 10 1 of 5 COE318 Lecture Notes Week 10 (Nov 7, 2011) Topics More about exceptions References Head First Java: Chapter 11 (Risky Behavior) The Java Tutorial:
More information