Java Compiler Errors

Java Compiler Errors - Compile and Runtime Errors in Java...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Compile and Runtime Errors in Java Mordechai (Moti) Ben-Ari Department of Science Teaching Weizmann Institute of Science Rehovot 76100 Israel http://stwww.weizmann.ac.il/g-cs/benari/ January 24, 2007 This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/ by-nc-nd/2.5/ ; or, (b) send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. Acknowledgement Otto Seppl and Niko Myller contributed many helpful suggestions. Contents 1 Introduction 5 2 Compile-time Errors 6 2.1 Syntax errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1 . . . expected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.2 unclosed string literal . . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.3 illegal start of expression . . . . . . . . . . . . . . . . . . . . . . 8 2.1.4 not a statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.1 cannot find symbol . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.2 . . . is already defined in . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.3 array required but . . . found . . . . . . . . . . . . . . . . . . . . 10 2.2.4 . . . has private access in . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3.1 variable . . . might not have been initialized . . . . . . . . . . . . 11 2.3.2 . . . in . . . cannot be applied to . . . . . . . . . . . . . . . . . . . . . 11 2.3.3 operator . . . cannot be applied to . . . ,. . . . . . . . . . . . . . . . . 12 2.3.4 possible loss of precision . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.5 incompatible types . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.6 inconvertible types . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4 Return statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4.1 missing return statement . . . . . . . . . . . . . . . . . . . . . . 13 2.4.2 missing return value . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.4.3 cannot return a value from method whose result type is void . 14 2.4.4 invalid method declaration; return type required . . . . . . . . 14 2.4.5 unreachable statement . . . . . . . . . . . . . . . . . . . . . . . . 15 2.5 Access to static entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.5.1 non-static variable cannot be referenced from a static context . . 16 2.5.2 non-static method cannot be referenced from a static context . . 16 3 3 Runtime Errors 17 3.1 Out of range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.1.1 ArrayIndexOutOfRange . . . . . . . . . . . . . . . . . . . . . . . 18 3.1.2 StringIndexOutOfRange . . . . . . . . . . . . . . . . . . . . . . .StringIndexOutOfRange ....
View Full Document

This note was uploaded on 02/14/2011 for the course CSI 201 taught by Professor Doanne during the Summer '08 term at SUNY Albany.

Page1 / 28

Java Compiler Errors - Compile and Runtime Errors in Java...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online