Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet69/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   65   66   67   68   69   70   71   72   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

Common Exceptions
In Java, it is conceivable to characterize two categories of Exceptions and Errors.
Programmatic  exceptions:  -  These  special  cases  are  tossed  unequivocally  by  the
application  or  the  API  software  engineers  Examples:  Illegalargumentexception,
IllegalStateException.
JVM  Exceptions:  -  These  are  exemptions/mistakes  that  are  solely  or  consistently
thrown
by
the
JVM.
Some
exceptions
of
this
class
are
ArrayIndexOutOfBoundsException,
NullPointerException
and
ClassCastException.



Interfaces and Packages
Abstract methods when brought together form a package. A class actualizes an interface,
consequently  inheriting  the  interface’s  abstract  methods.  An  interface  is  not  a  class.
Composing an interface is like composing a class. However, they are two separate ideas. A
class portrays the properties and behaviours of an object. On the other hand, An interface
contains behaviours that a class shall implement.
Unless the class that actualizes the interface is abstract, all the methods for the interface
need  to  be  implemented  in  the  class.  An  interface  is  like  a  class  in  the  accompanying
ways:
An interface is composed in a file with a .java augmentation, with the name of the
interface matching the name of the file.
An interface can contain any number of methods.
Interfaces  show  up  in  packages,  and  their  relating  bytecode  file  must  be  in  a
directory structure that matches the name of the package.
The bytecode of an interface shows up in a .class record.
On the other hand, an interface is unique and different from a class in a few ways. These
are:
An interface does not contain any constructors.
Interface cannot be instantiated
Instance fields cannot be contained in an interface. It is a requirement of interfaces
that the main fields in them must be final and static.
It is a requirement that all of the methods must be abstract methods.
An interface can extend different interfaces.
A class does not access an interface. Actually, a class implements an interface.

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   65   66   67   68   69   70   71   72   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling