0% found this document useful (0 votes)
3 views56 pages

Oops With Java Unit 3

The document discusses various new features in Java, particularly focusing on updates introduced in Java 8 and later versions. Key topics include the Stream API, static and default methods in interfaces, diamond syntax, and enhancements in switch statements. It emphasizes the importance of these features for improving code readability and functionality.

Uploaded by

ghostline.secure
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views56 pages

Oops With Java Unit 3

The document discusses various new features in Java, particularly focusing on updates introduced in Java 8 and later versions. Key topics include the Stream API, static and default methods in interfaces, diamond syntax, and enhancements in switch statements. It emphasizes the importance of these features for improving code readability and functionality.

Uploaded by

ghostline.secure
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

lOMoARcPSD|39712704

OOPS with Java Unit 3

Object Oriented Programming in JAVA Lab (Dr. A.P.J. Abdul Kalam Technical
University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Soniya Gupta (soniyagupta1154@[Link])
lOMoARcPSD|39712704

Object Oriented Programming with Java


AKTU Unit :- 3 BCS-403
Java New Features

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Stream API is a newly added feature to the Collections API in Java 8. A


stream represents a sequence of elements & supports different operations
(Filter, Sort, Map, and Collect) from a collection.
Downloaded by Soniya Gupta (soniyagupta1154@[Link])
lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Static method is a static member to the Interface, cant be overridden


(as with the class), default method is the default implementation of a
method which might be overridden.
Downloaded by Soniya Gupta (soniyagupta1154@[Link])
lOMoARcPSD|39712704

Difference between Static Interface Method and Default Interface Method

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

ForEach Method

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

This is how JDK now looks


like. On the bottom, we
have “[Link]” module
that every other module
implicitly or explicitly depends
on. As you can see, this
dependency graph is
a DAG which means no
circular dependency allowed.

It is a name of module and should follow the reverse-domain-pattern.


Like we name packages, e.g. [Link].
Downloaded by Soniya Gupta (soniyagupta1154@[Link])
lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Diamond Syntax with Inner Anonymous Class

, It is an inner class without a name and for which


only a single object is created. An anonymous inner class can be useful
when making an instance of an object with certain “extras” such as
overriding methods of a class or interface, without having to actually
subclass a class.

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Diamond syntax, sometimes known as the


diamond operator, It was added to Java 7 as just
a new feature. The diamond operator makes it
easier to employ generics while building an
object.

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

The Java releases up to and including 13 are rather manageable in terms


of their innovations. This is true even for Java 11 as an LTS version.
Fortunately, Java 14 brings a good slew of useful enhancements:
On the one hand, there are the convenient syntax changes in switch.

Let me conclude: The new syntax of switch seems to be just a small


change, but it has an enormous effect on readability and ease of use.
Downloaded by Soniya Gupta (soniyagupta1154@[Link])
lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])


lOMoARcPSD|39712704

Downloaded by Soniya Gupta (soniyagupta1154@[Link])

You might also like