What is software testing? Software testing is designing, executing and evaluating test cases in order to detect faults.
|
|
- Nathaniel Miller
- 6 years ago
- Views:
Transcription
1 ϖοιδ τεσταδδανδχουντ() { ασσερ τεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ϖοιδ τεσταδδανδχουντ() { ασσερ τεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ιντ αδδανδχουντ(λιστ λιστ) { ρετυρν λιστ.σιζε(); ιντ αδδανδχουντ(λιστ λιστ) { ρετυρν λιστ.σιζε(); What is software testing? Code Coverage & Mutation Testing Static code analysis, lecture #8 Software testing is designing, executing and evaluating test cases in order to detect faults. Requirements, Design, Code... Test models (frameworks) classical approach to software testing bartosz.bogacki@cs.put.poznan.pl Application modelling Evaluated knowledge Test model based on application Results analysis Tests designing Results Testing strategy System testing Tests implementation Test cases How to assure high quality of test cases? Code coverage analysis Quality of test cases is low if tests don t execute relevant parts of code Test cases: Program code:? Code coverage (test coverage): describes the degree to which the source code of a program has been tested Code coverage analysis is the process of: Finding areas of a program not exercised by test cases, Creating additional test cases to increase coverage, and Determining a quantitative measure of code coverage, which is an indirect measure of tests quality. Test coverage types Main test coverage types Statement Coverage Basic Block Coverage Decision Coverage Condition Coverage Path Coverage Function/Method Coverage Call Coverage Data Flow Coverage...many, many more Coverage methods important for practitioners are: Statement coverage Basic block coverage Decision coverage Condition coverage Path coverage Method coverage Class coverage 1
2 Statement coverage Statement coverage Reports whether each executable statement was encountered Other known names line coverage, segment coverage Example code and test case int addandcount(list list) { list.add( Sample text ); return list.size(); void testaddandcount() { assertequals(1, o.addandcount(new ArrayList()); void testaddandcount() { assertequals(1, o.addandcount(new ArrayList()); int addandcount(list list) { list.add( Sample text ); return list.size(); Coverage = 100% int addandcount(list list) { list.add( Sample text ); return list.size(); What if list was null? 100% of statement coverage doesn t guarantee, that the code was completely tested. Basic block coverage Basic block coverage The same as statement coverage except the unit of code measured is each sequence of non-branching statements A non-branching statement is one that does not affect chain of execution Branching statements include all looping statements, conditional statement, break, continue, and return Example code and coverage values void addconst(list list) { list.add( Sample text 1 ); list.add( Sample text 2 ); list.add( Sample text 2 ); else { System.out.println( Empty ); *assumption: if/else were counted as 2 statements assertequals(1, o.addconst(new ArrayList())); assertequals(1, o.addconst(null)); single unit of code Statement coverage Basic block coverage 83% 75% 50% 75% Decision coverage Decision coverage Reports whether boolean expressions tested in control structures evaluated to both true and false The entire boolean expression is considered one true-or-false predicate regardless of whether it contains logical-and (&&) or logical-or ( ) operators Other known names: branch coverage, all-edges coverage, C2 Example code and coverage values void addconst(list list) { list.add( Sample text 1 ); list.add( Sample text 2 ); list.add( Sample text 2 ); else { System.out.println( Empty ); assertequals(1, o.addconst(new ArrayList())); assertequals(1, o.addconst(null)); Decision coverage 50% 50% 2
3 Decision coverage Condition coverage Short-circuit operators issue if (condition1 && (condition2 o2.method())) { System.out.println( Test case 1 ); else { System.out.println( Test case 2 ); Test case 1: condition1=true; condition2=true if statement value = true Test case 2: condition1=false; if statement value = false Coverage = 100%, but o2.method() was never executed! Similar to decision coverage but has better sensitivity to the control flow Reports the true or false outcome of each boolean sub-expression, separated by logical-and and logical-or if they occur Path coverage Path coverage Reports whether each of the possible paths in each method have been followed A path is a unique sequence of branches within the method A large number of variations of this measure exist to cope with loops Boundary-interior path testing For loops: zero repetitions and more than zero repetitions For do-while loop: one iteration and more than one iteration The number of paths is exponential to the number of branches a method containing 10 if-statements has 1024 paths to test adding one more if-statement doubles the count to 2048 Sometimes 100% of coverage is not feasible, example: System.out.println ( Value + list.get(1)); logger.debug ( Control point 1 ); list.add( Bartek ); Method coverage Class coverage This measure reports whether each method was invoked It is useful during preliminary testing to assure at least some coverage in all areas of the software Looking out for uncovered methods is a good technique for detecting either dead code or code than needs more test attention This measure reports whether each class was accessed A class is considered to have been covered if it has been loaded and initialized by the JVM Similar to the method coverage, useful in preliminary testing to assure at least some coverage in all areas of the software 3
4 ϖοιδ τεσταδδανδχουντ() { ασσερτεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ϖοιδ τεσταδδανδχουντ() { ασσερτεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ιντ αδδανδχουντ(λιστ λιστ) { ρετυρν λιστ.σιζ ε() ; ιντ αδδανδχουντ(λιστ λιστ) { ρετυρν λιστ.σιζ ε() ; Popular coverage analysis tools Emma Coverlipse Emma Clover JCoverage Runs as a separate java program Generates hierarchical html reports Uses Class coverage Method coverage Line coverage Basic block coverage License: CPL (Common Public License) Reference: Emma Is a code coverage sufficient? Sample screenshots Imagine the following public class MyClazz { List addperson(list list, String person) { /* list.add(person); */ logger.info ( Person: + person + was added ); return list; but we test nothing here! [the test has no assertions] void testaddperson() { MyClazz obj = new MyClazz(); obj.addperson(new ArrayList(), Bartek ); obj.addperson(null, null); Statement/basic block coverage = 100% Decision/condition coverage = 100% Class/method coverage = 100% Is a code coverage sufficient? How to assure high quality of test cases? The test doesn t check if the person was really added to the list The valid test case should be like: Quality of test cases is low if tests don t execute relevant parts of code (coverage is low) Test cases: Program code: void testaddperson() { MyClazz obj = new MyClazz(); List list = obj.addperson(new ArrayList(), Bartek ) assertequals ( Bartek, (String)list.get(1)); list = obj.addperson(null, null); assertnull (list);...but high code coverage, doesn t implicate high quality of tests. All responses from the tested code need to be checked and validated.? 4
5 Mutation Testing Traditional approach Mutation testing Mutant modified source code Equivalent mutant modified source code that behaves as an original Killed mutant mutant that made at least one test case to fail Live mutant - mutant that didn t make any test case to fail Score - the percentage of changes that made the tests to fail number_of_killed_mutants score = number_of_killed_mutants+number_of_live_mutants Mutation testing Mutation testing Consider the example: public int bar(int a) Mutate the code: throws IllegalArgumentException if { ((a < 5) (a < 1)) { if ((a > 5) (a < 1)) { throw new IllegalArgumentException(); int c = a; for (int i = 0; i < a; i++) { c *= 10; return c; public void testbar1 () { assertequals (3000, new Foo().bar(3)); Mutant killed! exception thrown instead of value 3000 public void testbar2 () { Mutant killed! try { exception not thrown new Foo().bar(6); fail ("Exception not thrown"); catch (IllegalArgumentException e) { Consider the example: public int bar(int a) throws IllegalArgumentException { if ((a > 5) (a < 1)) { throw new IllegalArgumentException(); int c = a; for (int i = 0; i < a; i++) { c *= 10; return c; public void testbar1 () { assertequals (3000, new Foo().bar(3)); public void testbar2 () { try { new Foo().bar(6); fail ("Exception not thrown"); catch (IllegalArgumentException e) { Mutate the code: for (int i = 0; i > a; i++) Mutant killed! value 3 returned instead of value 3000 Mutation testing Mutation testing Consider the example: public int bar(int a) throws IllegalArgumentException { if ((a > 5) (a < 1)) { throw new IllegalArgumentException(); int c = a; for (int i = 0; i < a; i++) { c *= 10; return c; public void testbar1 () { assertequals (3000, new Foo().bar(3)); public void testbar2 () { try { new Foo().bar(6); fail ("Exception not thrown"); catch (IllegalArgumentException e) { Mutate the code: c += 10 Mutant killed! value 33 returned instead of value 3000 A test case that kills a mutant must satisfy three conditions: The reachability condition is that the mutated statement must be reached. The necessity condition is that once the mutated statement is executed, the test case must cause the mutant program to behave erroneously. The sufficiency condition states that the incorrect state must propagate through the program's computation to result in a failure. 5
6 Mutation types Mutations at lexical level Mutation can be introduced at different level of program processing Static mutation: lexical analysis syntax analysis bytecode analysis Dynamic mutation: modified run-time All mutations are made in scanner (at lexical analysis stage) After some change was made the code is compiled, test cases are executed, if all tests passed - live mutant was found (proper message saying what was changed should be displayed) Examples of lexical level mutations Lexical level mutations Example 1: List addperson(list list, String person) { /* list.add(person); */ logger.info ( Person: + person + was added ); return list; Example 2: if ((true) (list!= null)) public static boolean issamelength(long[] a1, long[] a2) { if ((a1 == null && a2!= null && a2.length > 0) (a2 == null && a1!= null && a1.length > 0) (a1!= null && a2!= null && a1.length!= a2.length)) { return false; return true; return true; Sample set of mutations: numeric literals (ie. 0 -> 1) true -> false false -> true if( -> if(true if( -> if(false && == ->!=!= -> == ++ -> > ++ Problems with lexical level mutations Problems with lexical level mutations...but what if the source is like: public static boolean toboolean(int value, int truevalue, int falsevalue) { if (value == truevalue) { return true; else if (value == falsevalue) { return false; // no match throw new IllegalArgumentException("The Integer did not match either specified value"); false -> true public static boolean toboolean(int value, int truevalue, int truevalue) { if (value == truevalue) { return true; else if (value == truevalue) { return true; // no match throw new IllegalArgumentException("The Integer did not match either specified value");...or is like: String valuestring (int v1, int v2) { Integer i = new Integer (v1 + v2); String s = "value is: " + i + "."; return s; + -> - String valuestring (int v1, int v2) { Integer i = new Integer (v1 + v2); String s = "value is: " - i + "."; return s; 6
7 Mutations at lexical level Mutations at lexical level Advantages Easy to design and develop Faster than syntax-based approach Easy to use Disadvantages Slow (modify/compile/execute cycle) Mutations are not syntax preserving Small set of applicable mutations Jester the JUnit test tester Syntax level mutations An example of lexical-level mutation system is Jester ( Mutations are made in parser (at syntax analysis stage or during AST analysis) After some change was made the code is compiled, test cases are executed, if all tests passed - live mutant was found (proper message saying what was changed should be displayed) Syntax level mutations Examples of method-level mutations Method-level mutations for Java: Arithmetic Operator Replacement Arithmetic Operator Insertion Arithmetic Operator Deletion Relational Operator Replacement Conditional Operator Replacement Conditional Operator Insertion Conditional Operator Deletion Shift Operator Replacement Logical Operator Replacement Logical Operator Insertion Logical Operator Deletion Assignment Operator Replacement Arithmetic Operator Insertion a -> ++a public int bar(int a) throws IllegalArgumentException { if ((a > 5) (a < 1)) { throw new IllegalArgumentException(); Conditional Operator Replacement (a > 5) -> int!(a > c 5) = a; for (int i = 0; i < a; i++) { c *= -10; return c + a; Assignment Operator Replacement *= -> += Arithmetic Operator Deletion -10 -> 10 Conditional Operator Replacement -> && Relational Operator Replacement a < 1 -> a >= 1 Arithmetic Operator Replacement c + a -> c - a Arithmetic Operator Replacement i++ -> i-- 7
8 Syntax level mutations Syntax level mutations Class-level mutations for Java: Encapsulation Access modifier change Hiding variable deletion Hiding variable insertion Overriding method deletion Overriding method calling position change Inheritance Overriding method rename super keyword insertion super keyword deletion Explicit call to a parent's constructor deletion new method call with child class type Member variable declaration with parent class type Parameter variable declaration with child class type Type cast operator insertion Class-level mutations for Java: Polymorphism Cast type change Type cast operator deletion Reference assignment with other comparable variable Overloading method contents replace Overloading method deletion Arguments of overloading method call change this keyword insertion this keyword deletion static modifer insertion static modifer deletion Syntax level mutations Examples of class-level mutations Class-level mutations for Java: Java-Specific Features Member variable initialization deletion Java-supported default constructor creation Reference assignment and content assignment replacement Reference comparison and content comparison replacement Acessor method change Modifer method change Explicit call of a parent's constructor deletion public Stack (int a) { Access modifier change // super (a); private int size = 10; class MyStack extends SimpleStack { int size = 10; Overriding method deletion public MyStack (int a) //{ void push (int a) { super (a); // ++size; // super.setsize(size); // super.push(a); // void push (int a) { ++size; super.setsize(size); super.push (a); super keyword deletion... setsize(size); super.push(a);... Overridden method calling position change... super.push(a); super.setsize(size);... Examples of class-level mutations Mutations at syntax level new method call with child class type class Client extends stack Dummy = new { MyStack(10); BaseStack stack; public Client () { stack = new BaseStack(10); Argument of overloading method change valuestring (20, 1); Object a_1_20() { valuestring (1, 20); Advantages More precise than lexical-based mutators Greater number of applicable mutants Object valuestring (int v1, int v2) { Integer i = new Integer (v1); Integer j = new Integer (v2); String s = "value: " + i + " " + j; return s; Reference assignment with other compatible type return i; 8
9 Mutations at syntax level Lava Disadvantages Slow (modify/compile/execute cycle) More complicated to develop and maintain than lexical-based mutators An example of syntax-level mutation system is Lava ( Mutations at bytecode level Mutations at bytecode level Mutations are made on intermediate representation (after compilation) After some change was made test cases are executed, if all tests passed - live mutant was found (proper message saying what was changed should be displayed) Developed with bytecode translation tools like: BCEL, BCA, Javassist, JOIE, JMangler, etc. Applicable mutations: Method-level mutations Class-level mutations Bytecode level mutations Bytecode level mutations Arithmetic Operator Replacement new method call with child class type public static int sum(int a, int b) { // return a + b; iload_0 iload_1 iadd ireturn public static int sum(int a, int b) { // return a - b; iload_0 iload_1 isub ireturn ArrayList list; class MyList extends ArrayList {; void assignlist() { // list = new ArrayList (); aload_0 new #18 <Class ArrayList> dup invokespecial #19 <Method void ArrayList()> putfield #21 <Field ArrayList list> return ArrayList list; void assignlist() {// list = new MyList (); aload_0 new #44 <Class MyList> dup invokespecial #45 <Method void MyList()> putfield #21 <Field ArrayList list> return 9
10 Mutations at syntax level Mutations at syntax level Advantages More precise than lexical-based mutators Greater number of applicable mutants Faster than lexical- and syntax-based methods (due to elimination of compilation time) Disadvantages More complicated to develop and maintain than lexical-, or syntax-based mutators mujava (µjava) Research directions An example of bytecode-level mutation system is mujava ( Selective mutations Schema-based mutation analysis Aspect-based mutations (response injection) Summary Further reading Good tests are planned and have sufficient code coverage Basic code coverage methods have lot of weaknesses, aggregated model is preferred Full code coverage doesn t guarantee, that project have good tests Lack of code coverage guarantees that the project has poor tests Mutation testing can be used to test test cases Mothra: Jester: mujava: 10
11 The end Thank you! 11
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 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 informationClasses, interfaces, & documentation. Review of basic building blocks
Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform
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 informationIntroduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity
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 informationFault-based testing. Automated testing and verification. J.P. Galeotti - Alessandra Gorla. slides by Gordon Fraser. Thursday, January 17, 13
Fault-based testing Automated testing and verification J.P. Galeotti - Alessandra Gorla slides by Gordon Fraser How good are my tests? How good are my tests? Path testing Boundary interior testing LCSAJ
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 informationAspect-oriented Response Injection: an Alternative to Classical Mutation Testing
Aspect-oriented Response Injection: an Alternative to Classical Mutation Testing Bartosz Bogacki, Bartosz Walter Institute of Computing Science, Pozna University of Technology, Poland {Bartosz Bogacki,
More informationAdvanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II
Advanced Programming - JAVA Lecture 4 OOP Concepts in JAVA PART II Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Ad hoc-polymorphism Outline Method overloading Sub-type Polymorphism Method overriding Dynamic
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 informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationCO Java SE 8: Fundamentals
CO-83527 Java SE 8: Fundamentals Summary Duration 5 Days Audience Application Developer, Developer, Project Manager, Systems Administrator, Technical Administrator, Technical Consultant and Web Administrator
More informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
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 informationRules and syntax for inheritance. The boring stuff
Rules and syntax for inheritance The boring stuff The compiler adds a call to super() Unless you explicitly call the constructor of the superclass, using super(), the compiler will add such a call for
More informationCS159. Nathan Sprague. September 30, 2015
CS159 Nathan Sprague September 30, 2015 Testing Happens at Multiple Levels Unit Testing - Test individual classes in isolation. Focus is on making sure that each method works according to specification.
More informationCONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17
List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code
More informationWhat is Mutation Testing? Mutation Testing. Test Case Adequacy. Mutation Testing. Mutant Programs. Example Mutation
What is Mutation Testing? Mutation Testing Breaking the application to test it n Mutation Testing is a testing technique that focuses on measuring the adequacy of test cases n Mutation Testing is NOT a
More informationJava for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.
Java for Non Majors Final Study Guide April 26, 2017 The test consists of 1. Multiple choice questions 2. Given code, find the output 3. Code writing questions 4. Code debugging question 5. Short answer
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 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 informationAbsolute C++ Walter Savitch
Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents
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 informationWA1278 Introduction to Java Using Eclipse
Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA1278 Introduction to Java Using Eclipse This course introduces the Java
More informationDefinition of DJ (Diminished Java)
Definition of DJ (Diminished Java) version 0.5 Jay Ligatti 1 Introduction DJ is a small programming language similar to Java. DJ has been designed to try to satisfy two opposing goals: 1. DJ is a complete
More informationCMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are "built" on top of that.
CMSC131 Inheritance Object When we talked about Object, I mentioned that all Java classes are "built" on top of that. This came up when talking about the Java standard equals operator: boolean equals(object
More informationOOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.
OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
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 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 informationCS159. Nathan Sprague
CS159 Nathan Sprague What s wrong with the following code? 1 /* ************************************************** 2 * Return the mean, or -1 if the array has length 0. 3 ***************************************************
More informationLecture Notes Chapter #9_b Inheritance & Polymorphism
Lecture Notes Chapter #9_b Inheritance & Polymorphism Inheritance results from deriving new classes from existing classes Root Class all java classes are derived from the java.lang.object class GeometricObject1
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 information1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8
Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(
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 informationArray Based Lists. Collections
Array Based Lists Reading: RS Chapter 15 1 Collections Data structures stores elements in a manner that makes it easy for a client to work with the elements Specific collections are specialized for particular
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 informationCore 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 informationLECTURE 3. Compiler Phases
LECTURE 3 Compiler Phases COMPILER PHASES Compilation of a program proceeds through a fixed series of phases. Each phase uses an (intermediate) form of the program produced by an earlier phase. Subsequent
More informationUNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED
UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 11 CLASSES CONTINUED EXERCISE 11.1 1. static public final int DEFAULT_NUM_SCORES = 3; 2. Java allocates a separate set of memory cells in each instance
More informationAN EVALUATION OF MUTATION OPERATORS FOR EQUIVALENT MUTANTS. Maryam Umar
AN EVALUATION OF MUTATION OPERATORS FOR EQUIVALENT MUTANTS By Maryam Umar Supervised By Mark Harman A project submitted to the Department of Computer Science. King s College, London. In partial fulfilment
More informationJava for Non Majors Spring 2018
Java for Non Majors Spring 2018 Final Study Guide The test consists of 1. Multiple choice questions - 15 x 2 = 30 points 2. Given code, find the output - 3 x 5 = 15 points 3. Short answer questions - 3
More informationExam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming
Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose
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 informationSelf-review Questions
7Class Relationships 106 Chapter 7: Class Relationships Self-review Questions 7.1 How is association between classes implemented? An association between two classes is realized as a link between instance
More informationAtelier 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 informationWhite-Box Testing Techniques
T-76.5613 Software Testing and Quality Assurance Lecture 3, 18.9.2006 White-Box Testing Techniques SoberIT Content What are white-box testing techniques Control flow testing Statement coverage Branch coverage
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 informationWhat is it? CMSC 433 Programming Language Technologies and Paradigms Spring Approach 1. Disadvantage of Approach 1
CMSC 433 Programming Language Technologies and Paradigms Spring 2007 Singleton Pattern Mar. 13, 2007 What is it? If you need to make sure that there can be one and only one instance of a class. For example,
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 informationJava 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 informationCS-202 Introduction to Object Oriented Programming
CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction
More informationCompuScholar, Inc. 9th - 12th grades
CompuScholar, Inc. Alignment to the College Board AP Computer Science A Standards 9th - 12th grades AP Course Details: Course Title: Grade Level: Standards Link: AP Computer Science A 9th - 12th grades
More informationC++ (Non for C Programmer) (BT307) 40 Hours
C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular
More informationStandard. Number of Correlations
Computer Science 2016 This assessment contains 80 items, but only 80 are used at one time. Programming and Software Development Number of Correlations Standard Type Standard 2 Duty 1) CONTENT STANDARD
More informationJust-In-Time Compilation
Just-In-Time Compilation Thiemo Bucciarelli Institute for Software Engineering and Programming Languages 18. Januar 2016 T. Bucciarelli 18. Januar 2016 1/25 Agenda Definitions Just-In-Time Compilation
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 informationVIRTUAL FUNCTIONS Chapter 10
1 VIRTUAL FUNCTIONS Chapter 10 OBJECTIVES Polymorphism in C++ Pointers to derived classes Important point on inheritance Introduction to virtual functions Virtual destructors More about virtual functions
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 informationThe Structure of a Syntax-Directed Compiler
Source Program (Character Stream) Scanner Tokens Parser Abstract Syntax Tree Type Checker (AST) Decorated AST Translator Intermediate Representation Symbol Tables Optimizer (IR) IR Code Generator Target
More informationF1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept
F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming
More information1B1b Inheritance. Inheritance. Agenda. Subclass and Superclass. Superclass. Generalisation & Specialisation. Shapes and Squares. 1B1b Lecture Slides
1B1b Inheritance Agenda Introduction to inheritance. How Java supports inheritance. Inheritance is a key feature of object-oriented oriented programming. 1 2 Inheritance Models the kind-of or specialisation-of
More informationIn this lab we will practice creating, throwing and handling exceptions.
Lab 5 Exceptions Exceptions indicate that a program has encountered an unforeseen problem. While some problems place programmers at fault (for example, using an index that is outside the boundaries of
More informationAbout this exam review
Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review
More informationSoftware Paradigms (Lesson 3) Object-Oriented Paradigm (2)
Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Table of Contents 1 Reusing Classes... 2 1.1 Composition... 2 1.2 Inheritance... 4 1.2.1 Extending Classes... 5 1.2.2 Method Overriding... 7 1.2.3
More informationBasics of Java: Expressions & Statements. Nathaniel Osgood CMPT 858 February 15, 2011
Basics of Java: Expressions & Statements Nathaniel Osgood CMPT 858 February 15, 2011 Java as a Formal Language Java supports many constructs that serve different functions Class & Interface declarations
More informationAP Computer Science Chapter 10 Implementing and Using Classes Study Guide
AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within
More informationLecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University
Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types
More informationCS18000: Problem Solving And Object-Oriented Programming
CS18000: Problem Solving And Object-Oriented Programming Data Abstraction: Inheritance 7 March 2011 Prof. Chris Clifton Data Abstraction Continued Abstract data type provides Well-defined interface Separation
More informationCLASS DESIGN. Objectives MODULE 4
MODULE 4 CLASS DESIGN Objectives > After completing this lesson, you should be able to do the following: Use access levels: private, protected, default, and public. Override methods Overload constructors
More informationObject-Oriented Design Lecture 3 CSU 370 Fall 2007 (Pucella) Friday, Sep 14, 2007
Object-Oriented Design Lecture 3 CSU 370 Fall 2007 (Pucella) Friday, Sep 14, 2007 Java We will be programming in Java in this course. Partly because it is a reasonable language, and partly because you
More informationThe Java language has a wide variety of modifiers, including the following:
PART 5 5. Modifier Types The Java language has a wide variety of modifiers, including the following: Java Access Modifiers Non Access Modifiers 5.1 Access Control Modifiers Java provides a number of access
More informationAnatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis?
Anatomy of a Compiler Program (character stream) Lexical Analyzer (Scanner) Syntax Analyzer (Parser) Semantic Analysis Parse Tree Intermediate Code Generator Intermediate Code Optimizer Code Generator
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 informationConcepts of Programming Languages
Concepts of Programming Languages Lecture 10 - Object-Oriented Programming Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages
More informationInheritance. Transitivity
Inheritance Classes can be organized in a hierarchical structure based on the concept of inheritance Inheritance The property that instances of a sub-class can access both data and behavior associated
More informationChapter 13 Object Oriented Programming. Copyright 2006 The McGraw-Hill Companies, Inc.
Chapter 13 Object Oriented Programming Contents 13.1 Prelude: Abstract Data Types 13.2 The Object Model 13.4 Java 13.1 Prelude: Abstract Data Types Imperative programming paradigm Algorithms + Data Structures
More information(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days
Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented
More informationThis course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units.
This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. Introduction Overview Advancements in technology are
More informationInheritance and Polymorphism
Inheritance and Polymorphism Dr. M. G. Abbas Malik Assistant Professor Faculty of Computing and IT (North Jeddah Branch) King Abdulaziz University, Jeddah, KSA mgmalik@kau.edu.sa www.sanlp.org/malik/cpit305/ap.html
More informationCOMP1008 Exceptions. Runtime Error
Runtime Error COMP1008 Exceptions Unexpected error that terminates a program. Undesirable Not detectable by compiler. Caused by: Errors in the program logic. Unexpected failure of services E.g., file server
More information15CS45 : 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 informationThe 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 informationTopic 3 Encapsulation - Implementing Classes
Topic 3 Encapsulation - Implementing Classes And so, from Europe, we get things such as... object-oriented analysis and design (a clever way of breaking up software programming instructions and data into
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 informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes
More informationCOMP3131/9102: Programming Languages and Compilers
COMP3131/9102: Programming Languages and Compilers Jingling Xue School of Computer Science and Engineering The University of New South Wales Sydney, NSW 2052, Australia http://www.cse.unsw.edu.au/~cs3131
More informationStatic Program Analysis
Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1617/spa/ Recap: Taking Conditional Branches into Account Extending
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationChapter 11 Inheritance and Polymorphism. Motivations. Suppose you will define classes to model circles,
Chapter 11 Inheritance and Polymorphism 1 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common features. What is the best way to design
More informationType Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004
Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...
More informationSuper-Classes and sub-classes
Super-Classes and sub-classes Subclasses. Overriding Methods Subclass Constructors Inheritance Hierarchies Polymorphism Casting 1 Subclasses: Often you want to write a class that is a special case of an
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 informationInheritance. Inheritance allows the following two changes in derived class: 1. add new members; 2. override existing (in base class) methods.
Inheritance Inheritance is the act of deriving a new class from an existing one. Inheritance allows us to extend the functionality of the object. The new class automatically contains some or all methods
More informationTypes, Values and Variables (Chapter 4, JLS)
Lecture Notes CS 141 Winter 2005 Craig A. Rich Types, Values and Variables (Chapter 4, JLS) Primitive Types Values Representation boolean {false, true} 1-bit (possibly padded to 1 byte) Numeric Types Integral
More informationPractice for Chapter 11
Practice for Chapter 11 MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Object-oriented programming allows you to derive new classes from existing
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More informationCS 221 Review. Mason Vail
CS 221 Review Mason Vail Inheritance (1) Every class - except the Object class - directly inherits from one parent class. Object is the only class with no parent. If a class does not declare a parent using
More informationChapter 5 Object-Oriented Programming
Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares
More informationBM214E Object Oriented Programming Lecture 4
BM214E Object Oriented Programming Lecture 4 Computer Numbers Integers (byte, short, int, long) whole numbers exact relatively limited in magnitude (~10 19 ) Floating Point (float, double) fractional often
More information