tài liệu tự học java cho người mới bắt đầu

37 728 0
tài liệu tự học  java cho người mới bắt đầu

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Session 6 Module 8: More on Classes Module 9: Exceptions More on class & Exception / Session6 / 2 of 37 Module 7 - Review  Inheritance  Overloading of methods  Using abstract keyword  Using final keywords  Interfaces More on class & Exception / Session6 / 3 of 37 Module 8 - Objectives  Class variables  Nested class More on class & Exception / Session6 / 4 of 37 Class variables  Are declared using the static keyword  Once the value is modified, all instances of the class are updated to share the same value More on class & Exception / Session6 / 5 of 37 Access Class variables  Can also be manipulated without creating an instance of the class  Are referenced by the class name itself More on class & Exception / Session6 / 6 of 37 Static methods  Also known as class methods, do not have reference to any instance variable in a class, used to access class variables and methods.  The keyword this cannot be used inside a static method. More on class & Exception / Session6 / 7 of 37 Accessing class method  Can be accessed by using a class name  or  an instance name (not recommend) More on class & Exception / Session6 / 8 of 37 Static initializer  Is a block of code embraced in curly braces  It is preceded by the static keyword  It initializes the static variables in class  The static initialization block can reference only class variables that have been declared before it More on class & Exception / Session6 / 9 of 37 Nested class  A class defined within another class  It can have access to members of the outer class (enclosing class) even if the members are declared private  It can be used for:  Allow logical grouping of classes  Increases encapsulation  More maintainable code More on class & Exception / Session6 / 10 of 37 Different type of nested class  Member classes or non-static nested classes  Local classes  Anonymous classes  Static nested classes [...]... instantiated to access the instance variables and methods of the enclosing class More on class & Exception / Session6 / 14 of 37 Module 9 - Objectives Introduction to Exceptions  Exception handling in Java  User defined exceptions  Assertions  More on class & Exception / Session6 / 15 of 37 Introduction to Exceptions Explain the concept of Exceptions  Identify the different types of Exceptions ... 22 of 37 Types of Unchecked Exceptions All Unchecked exceptions are directly or indirectly derived from the RuntimeException class More on class & Exception / Session6 / 23 of 37 Exception handling in Java State the use of try-catch block  Describe the use of finally block  State the flow of execution in an exception handling block  Describe the use of throw and throws keyword  Describe the use . Session6 / 15 of 37 Module 9 - Objectives  Introduction to Exceptions  Exception handling in Java  User defined exceptions  Assertions More on class & Exception / Session6 / 16 of 37 Introduction

Ngày đăng: 22/11/2014, 16:39

Từ khóa liên quan

Mục lục

  • Session 6

  • Module 7 - Review

  • Module 8 - Objectives

  • Class variables

  • Access Class variables

  • Static methods

  • Accessing class method

  • Static initializer

  • Nested class

  • Different type of nested class

  • Member classes or non-static nested classes

  • Local classes

  • Anonymous classes

  • Static nested classes

  • Module 9 - Objectives

  • Introduction to Exceptions

  • Explain the concept of Exceptions

  • Causes for Exceptions

  • Classification of Exceptions

  • Checked Exceptions

Tài liệu cùng người dùng

Tài liệu liên quan