The document provides an overview of several Java topics including class loaders, the Object class, collections, exception handling, and files and I/O. It begins with an agenda and rules for the session. It then discusses class loaders and how they load classes, custom class loaders, and building a simple class loader. Next, it describes the Object class and its common methods. It continues with an overview of collections, interfaces like Collection and Comparator, and the Collections utility class. The document then covers exception handling concepts like checked, unchecked exceptions and errors, and how to catch and handle exceptions. Finally, it discusses Java I/O streams and input/output stream classes.
Serialization & De-serialization in JavaInnovationM
When you create a class, you may create an object for that particular class and once we execute/terminate the program, the object is destroyed by itself (Garbage Collector thread).
To learn about the basic concepts of Object Oriented Programming and Inheritance plus different Inheritance Models and interview questions will be covered.
Concurrent Programming in Java provides a brief overview of the following topics:
• Java language support for concurrency
• Concurrency utilities (java.util.concurrent package)
• Java collections for multithreading (java.util package)
• Parallel streams in Java 8.
Try out the examples. Source code here: https://github.com/CodeOpsTech/ConcurrentJava
At first glance, writing concurrent programs in Java seems like a straight-forward task. But the devil is in the detail. Fortunately, these details are strictly regulated by the Java memory model which, roughly speaking, decides what values a program can observe for a field at any given time. Without respecting the memory model, a Java program might behave erratic and yield bugs that only occure on some hardware platforms. This presentation summarizes the guarantees that are given by Java's memory model and teaches how to properly use volatile and final fields or synchronized code blocks. Instead of discussing the model in terms of memory model formalisms, this presentation builds on easy-to follow Java code examples.
Serialization & De-serialization in JavaInnovationM
When you create a class, you may create an object for that particular class and once we execute/terminate the program, the object is destroyed by itself (Garbage Collector thread).
To learn about the basic concepts of Object Oriented Programming and Inheritance plus different Inheritance Models and interview questions will be covered.
Concurrent Programming in Java provides a brief overview of the following topics:
• Java language support for concurrency
• Concurrency utilities (java.util.concurrent package)
• Java collections for multithreading (java.util package)
• Parallel streams in Java 8.
Try out the examples. Source code here: https://github.com/CodeOpsTech/ConcurrentJava
At first glance, writing concurrent programs in Java seems like a straight-forward task. But the devil is in the detail. Fortunately, these details are strictly regulated by the Java memory model which, roughly speaking, decides what values a program can observe for a field at any given time. Without respecting the memory model, a Java program might behave erratic and yield bugs that only occure on some hardware platforms. This presentation summarizes the guarantees that are given by Java's memory model and teaches how to properly use volatile and final fields or synchronized code blocks. Instead of discussing the model in terms of memory model formalisms, this presentation builds on easy-to follow Java code examples.
Iterator - a powerful but underappreciated design patternNitin Bhide
Iterator design pattern is described in GoF ‘Design Patterns’ book. It is used at many places (e.g. Sql Cursor is a ‘iterator’), C++ standard template library uses iterators heavily. .Net Linq interfaces are based IEnumerable (i.e. iterator). However, I don’t see projects creating/using ‘custom’ iterator classes. Many problems can be solved ‘elegantly’ by use of customized iterators. This talk is about ‘power of iterators’ and how custom iterators can solve common problems and help create modular/reusable code components.
Key Discussion Points
Typical examples of iterators in common use.
Kind of problems that can be ‘elegantly’ solved with iterators
When to use custom iterators?
How write custom iterators in C++/C#
From webinar I did on TechGig
http://www.techgig.com/expert-speak/Iterator-a-powerful-but-underappreciated-pattern-449
Synapse India Reviews About:
Functional/procedural programming:
program is a list of instructions to the computer
Object-oriented programming
program is composed of a collection objects that communicate with each other
Java 9 introduces modules to the Java programming language and its runtime. Despite this feature being optional, due to the modularization of the standard library existing applications might behave differently when running on a version 9 JVM. Furthermore, because of changes in the runtime, existing libraries and frameworks might not yet correctly process your modularized code. As a result, updating to a Java 9 VM and taking Java 9 into brings its challanges.
This talk discusses the practical implications of module boundaries and analyzes new limitations Java 9 imposes on the reflection API. This talk explains how reflection is used in popular frameworks like Spring and Hibernate and explains why existing applications might break or change their behavior when facing modularized code. Finally, this talk showcases alternatives to now failing Java programming patterns and weights their robustness with regard to the Java releases 10 and upward.
The presenter is an active contributor to open source and helped to migrate many popular Java libraries to supporting Java 9. As a consequence, he as been working with Java 9 for almost two years.
introduction, The Resolution of Property Names on Objects.
Closure
A "closure" is an expression (typically a function) that can have
free variables together with an environment that binds those
variables (that "closes" the expression)
This presentation describes key concepts in Java. I call it The Java Quicky.
This is part of a series of presentations to cover the Java programming language and its new offerings and versions in depth.
This is my attempt to compose a brief and cursory introduction to concepts in Java programming language. I call it Java Quicky.
I plan to extend and enhance it over time.
Iterator - a powerful but underappreciated design patternNitin Bhide
Iterator design pattern is described in GoF ‘Design Patterns’ book. It is used at many places (e.g. Sql Cursor is a ‘iterator’), C++ standard template library uses iterators heavily. .Net Linq interfaces are based IEnumerable (i.e. iterator). However, I don’t see projects creating/using ‘custom’ iterator classes. Many problems can be solved ‘elegantly’ by use of customized iterators. This talk is about ‘power of iterators’ and how custom iterators can solve common problems and help create modular/reusable code components.
Key Discussion Points
Typical examples of iterators in common use.
Kind of problems that can be ‘elegantly’ solved with iterators
When to use custom iterators?
How write custom iterators in C++/C#
From webinar I did on TechGig
http://www.techgig.com/expert-speak/Iterator-a-powerful-but-underappreciated-pattern-449
Synapse India Reviews About:
Functional/procedural programming:
program is a list of instructions to the computer
Object-oriented programming
program is composed of a collection objects that communicate with each other
Java 9 introduces modules to the Java programming language and its runtime. Despite this feature being optional, due to the modularization of the standard library existing applications might behave differently when running on a version 9 JVM. Furthermore, because of changes in the runtime, existing libraries and frameworks might not yet correctly process your modularized code. As a result, updating to a Java 9 VM and taking Java 9 into brings its challanges.
This talk discusses the practical implications of module boundaries and analyzes new limitations Java 9 imposes on the reflection API. This talk explains how reflection is used in popular frameworks like Spring and Hibernate and explains why existing applications might break or change their behavior when facing modularized code. Finally, this talk showcases alternatives to now failing Java programming patterns and weights their robustness with regard to the Java releases 10 and upward.
The presenter is an active contributor to open source and helped to migrate many popular Java libraries to supporting Java 9. As a consequence, he as been working with Java 9 for almost two years.
introduction, The Resolution of Property Names on Objects.
Closure
A "closure" is an expression (typically a function) that can have
free variables together with an environment that binds those
variables (that "closes" the expression)
This presentation describes key concepts in Java. I call it The Java Quicky.
This is part of a series of presentations to cover the Java programming language and its new offerings and versions in depth.
This is my attempt to compose a brief and cursory introduction to concepts in Java programming language. I call it Java Quicky.
I plan to extend and enhance it over time.
ZeroSpace is a part of Woxa Technology where industrial trainer are ready to trained you.Take a demo class and choose your future in the programming field. We offer to learn in latest technology with live project which is demanding.
feel free to contact us-: 8471003400
Woxa Technologies have great industrial exoerts in java field they work on the live projects with students they are not teacher they are industrial trainer.
for more information 8471003400
Java , basics of java programming, JVM, JRE, JDK detailed explanation. primitive datatype. this ppt explains the basic concepts of java clearly starting from variables to complex programmes. It has 55 slides which gives you better understanding
6+1 Technical Tips for Tech Startups (2023 Edition)Ahmed Misbah
In 2019, the failure rate of startups was 90%. Technology Startups (aka. Tech Startups) had the highest rate of failures at 63%. One of the causes of this high rate in tech startups can be wrong technical decisions and practices.
In this session, I describe 6 technical tips that can help tech startups truly become “Lean” to pave the way for success. The 6 technical tips will cover areas such as programming languages, development platforms, cloud-native architectures, testing, and big data.
The session will conclude with BONUS technical tips for all startups and not just tech startups. These bonus tips will prove very useful for:
1- Startups wishing to launch new apps with very little experience in software development OR
2- Companies wishing to initiate startup projects as part of their digital transformation.
I highly recommend this session for entrepreneurs who are about to start developing an innovative idea. It is also recommended for startups that have already started their journey and wish to improve.
Migrating to Microservices Patterns and Technologies (edition 2023)Ahmed Misbah
This session is targeted towards teams and organizations considering to migrate their applications from Monolithic to Microservice architecture. Migrating application architectures to Microservices is considered a key area of transformation in the IT world. Modernizing legacy applications to Kubernetes-based Microservices can prove to be very challenging if not planned correctly, taking into consideration the right technologies and enablers.
The session proposes Istio as an enabler for migrating to Microservices. Istio is an implementation of service mesh, a technology useful for migrating to Microservices iteratively and safely. We explain how Istio can be used as a bridge and enabler for modernizing legacy Monolithic applications to Microservices.
Are you considering Microservice architecture for your next project?
Are you planning to migrate an existing legacy / monolithic application to Microservices?
Are you curious about Microservice architecture?
If the answer to one of the above questions is YES, then this session is for you.
Join me to know all about Microservice architecture:
- When to adopt it?
- When not to adopt it?
- How to assess your team’s readiness to adopt Microservice architecture?
- Starting a new project with Microservice architecture.
- Migrate an existing project to Microservice architecture.
- Microservice architecture main anti-patterns and how to fix them.
- Are monoliths really that bad?
Istio as an enabler for migrating to microservices (edition 2022)Ahmed Misbah
This session is targeted towards teams and organizations considering to migrate their applications from monolithic to Microservice architecture by proposing Istio as an enabler. Istio is an implementation of service mesh, a technology useful for migrating to Microservices iteratively and safely.
Migrating application architectures to Microservices is considered a key area of transformation in the IT world. Modernizing legacy applications to Kubernetes-based Microservices can prove to be very challenging if not planned correctly, taking into consideration the right technologies and enablers.
This session explains how Istio can be used as a bridge and enabler for modernizing legacy monolithic applications to Microservices. Topics covered in the session will include:
1- Advantages of migrating to Microservices and service mesh .
2- Designing a Microservice application based on splitting an existing monolithic application.
3- Implementing Microservices iteratively as a strangler fig application with Istio.
4- Features Istio provides as a service mesh platform.
DevOps for absolute beginners (2022 edition)Ahmed Misbah
Are you planning to pursue a career in DevOps?
Already working with DevOps but want to know what’s new in 2022?
This session is for you!
Join us in the 2022 edition of “DevOps for absolute beginners” session, where you will learn all about DevOps from the perspective of People, Process, and Technology. We will be talking about topics like Automation, Continous Integration, Continous Delivery, Infrastructure as Code, etc. We will also be talking about the latest trends in DevOps, including Chaos Engineering, MLOps, and eBPF.
The session will conclude with great bonus material for software professional enthusiastic about DevOps, one of them being a carefully crafted learning path for DevOps from years of experience in the industry. Don’t miss out on the rest of the material.
Test Driven Development (TDD) is a core practice in the SDLC, especially ones that run using the agile mindset and leverage the practices of eXtreme programming. Since its inception and rediscovery by Kent beck in the late 1990s, it has gained popularity among many software development teams. However, like any popular software development practices, teams lose interest in TDD overtime and drop the practice all together. The main reason behind this is practicing it "the wrong way".
In this session, I present 7 anti-patterns that can ruin the TDD experience of a software development team. I also present how to counter these anti-patterns to fully leverage the benefits of TDD.
Implementing FaaS on Kubernetes using KubelessAhmed Misbah
This session discusses implementing Function-as-a-Service (FaaS) on Kubernetes using Kubeless. FaaS is part of Serverless architectures, which offer benefits such as reduced operational and development costs and optimized scaling. Those benefits are essential for companies looking to survive the economic crisis caused by COVID-19.
The session is organized so that it would introduce the audience to Serverless Architectures. It then covers Function-as-a-Service in details and how it is an evolution of Cloud services and Software Architectural styles. Finally, it covers Kubeless, the K8s native FaaS platform and most common FAQs on it.
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3Ahmed Misbah
Migrating application architectures to microservices is considered a key area of transformation in the IT world. Modernizing legacy applications to Kubernetes-based microservices can prove to be very challenging if not planned correctly, taking into consideration the right technologies and enablers.
This session explains how Istio can be used as an enabler for modernizing legacy monolithic applications to microservices. Topics covered in the presentation will include:
1- Advantages of migrating to microservices and service mesh
2- Designing a microservice application based on splitting an existing monolithic application
3- Implementing microservices iteratively as a strangler fig application with Istio
Are you a:
- University student or fresh graduate wishing to pursue a career in DevOps and want to prepare for it?
- Software Engineer (developer, tester, etc.) who is curious about DevOps?
- Software Engineer (developer, tester, etc.) wishing to switch from his/her current role to a DevOps related role?
This session is just for you!
Check out the video on YouTube at https://www.youtube.com/watch?v=yYWEOdORH40
In these slides, I explain the transition/transformation to the professional world. Very useful for fresh graduates. A lot of the contents in the presentation were inspired/taken from the slides of Chetana Mehta.
We presented this library at Java Developer Conference Cairo 2012. The purpose of this library is to provide developers with the capability to do Data Driven Testing on Android.
This presentation introduces the Big Data topic to Software Quality Assurance Engineers. It can also be useful for Software Developers and other software professionals.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
8. Class Loader
• The Java Classloader is a part of the Java
Runtime Environment that dynamically loads
Java classes into the Java Virtual Machine on
demand (i.e. Lazy Loading)
• When the JVM is started, three class loaders
are used:
– Bootstrap class loader (native implementation)
– Extensions class loader (loads code in extensions
dir)
– System class loader (loads code found on
java.class.path)
9.
10. Custom Class Loaders
• The Java class loader is written in Java. It is
therefore possible to create your own class
loader without understanding the finer details
of the Java Virtual Machine
• This makes it possible (for example):
1. To load or unload classes at runtime
2. To change the way the byte code is loaded
3. To modify the loaded byte code
11.
12. Building a SimpleClassLoader
• A class loader starts by being a subclass of
java.lang.ClassLoader
• The only abstract method that must be
implemented is loadClass()
13. Building a SimpleClassLoader
• The flow of loadClass() is as follows:
– Verify class name
– Check to see if the class requested has already
been loaded
– Check to see if the class is a "system" class
– Attempt to fetch the class from this class loader's
repository
– Define the class for the VM
– Resolve the class
– Return the class to the caller
19. Object Class
• The Object class is the parent class of all the
classes in java by default. In other words, it is
the topmost class of java
20. Object Class
public final Class getClass()
returns the Class class object of this
object. The Class class can further be used
to get the metadata of this class.
public int hashCode()
returns the hashcode number for this
object.
public boolean equals(Object obj) compares the given object to this object.
protected Object clone() throws
CloneNotSupportedException
creates and returns the exact copy (clone)
of this object.
public String toString()
returns the string representation of this
object.
protected void finalize()throws
Throwable
is invoked by the garbage collector before
object is being garbage collected.
21. Object Class
public final void notify()
wakes up single thread, waiting on this
object's monitor.
public final void notifyAll()
wakes up all the threads, waiting on this
object's monitor.
public final void wait(long
timeout)throws InterruptedException
causes the current thread to wait for the
specified milliseconds, until another
thread notifies (invokes notify() or
notifyAll() method).
public final void wait(long timeout,int
nanos)throws InterruptedException
causes the current thread to wait for the
specified miliseconds and nanoseconds,
until another thread notifies (invokes
notify() or notifyAll() method).
public final void wait()throws
InterruptedException
causes the current thread to wait, until
another thread notifies (invokes notify()
or notifyAll() method).
24. Collections
• Collections in java is a framework that provides
an architecture to store and manipulate the
group of objects
• All the operations that you perform on a data
such as searching, sorting, insertion,
manipulation, deletion etc. can be performed by
Java Collections
• Java Collection simply means a single unit of
objects. Java Collection framework provides
many interfaces (Set, List, Queue, etc.) and
classes (ArrayList, Vector, LinkedList,, HashSet,
LinkedHashSet, TreeSet, etc.)
28. Collection Interface
public boolean add(Object element) is used to insert an element in this collection.
public boolean addAll(Collection c)
is used to insert the specified collection
elements in the invoking collection.
public boolean remove(Object element)
is used to delete an element from this
collection.
public boolean removeAll(Collection c)
is used to delete all the elements of specified
collection from the invoking collection.
public boolean retainAll(Collection c)
is used to delete all the elements of invoking
collection except the specified collection.
public int size()
return the total number of elements in the
collection.
public void clear()
removes the total no of element from the
collection.
public boolean contains(Object element) is used to search an element.
29. public boolean containsAll(Collection c)
is used to search the specified collection in
this collection.
public Iterator iterator() returns an iterator.
public Object[] toArray() converts collection into array.
public boolean isEmpty() checks if collection is empty.
public boolean equals(Object element) matches two collection.
public int hashCode() returns the hashcode number for collection.
30. Java.util.Collections Class
• The java.util.Collections class consists
exclusively of static methods that operate on
or return collections
31. Sample Methods in Collections class
• static <T> int binarySearch(List<? extends
Comparable<? super T>> list, T key)
This method searches the specified list for the
specified object using the binary search
algorithm
• static <T> int binarySearch(List<? extends T>
list, T key, Comparator<? super T< c)
This method searches the specified list for the
specified object using the binary search
algorithm.
32. Sample Methods in Collections class
• static <T> T min(Collection<? extends T> coll,
Comparator<? super T> comp)
This method returns the minimum element of
the given collection, according to the order
induced by the specified comparator.
• static <T> T max(Collection<? extends T> coll,
Comparator<? super T> comp)
This method returns the maximum element of
the given collection, according to the order
induced by the specified comparator.
33. Sample Methods in Collections class
• static void reverse(List<?> list)
This method reverses the order of the elements
in the specified list.
• static <T> void sort(List<T> list, Comparator<?
super T> c)
This method sorts the specified list according to
the order induced by the specified comparator.
34. Comparable Interface
• Comparable interface is used to order the
objects of user-defined class
• public int compareTo(Object obj): is used to
compare the current object with the specified
object.
35. Comparator Interface
• Comparator interface is used to order the
objects of user-defined class
• public int compare(Object obj1,Object obj2):
compares the first object with second object
37. Why?
• Beginners usually start off by returning error
codes
• The inner working of your program should not
have a protocol
38. From the Clean Code book
if (deletePage(page) == E_OK) {
if (registry.deleteReference(page.name) == E_OK) {
if (configKeys.deleteKey(page.name.makeKey()) == E_OK){
logger.log("page deleted");
} else {
logger.log("configKey not deleted");
}
} else {
logger.log("deleteReference from registry failed");
}
} else {
logger.log("delete failed");
return E_ERROR;
}
Bad
try {
deletePage(page);
registry.deleteReference(page.name);
configKeys.deleteKey(page.name.makeKey());
}
catch (Exception e) {
logger.log(e.getMessage());
}
Good
Motive:
Error Codes awful nested IFs
But using Exceptions now, we can read the normal flow
39. Three Categories of Exceptions(1/3)
1. Checked exceptions: is an exception that
occurs at the compile time, these are also
called as compile time exceptions. These
exceptions cannot simply be ignored at the
time of compilation, the Programmer should
take care of (handle) these exceptions
40. Three Categories of Exceptions(2/3)
2. Unchecked exceptions: is an exception that
occurs at the time of execution, these are
also called as Runtime Exceptions, these
include programming bugs, such as logic
errors or improper use of an API. Runtime
exceptions are ignored at the time of
compilation
(e.g.ArrayIndexOutOfBoundsException and
NullPointerException).
41. Three Categories of Exceptions(3/3)
3. Errors: These are not exceptions at all, but
problems that arise beyond the control of the
user or the programmer. Errors are typically
ignored in your code because you can rarely
do anything about an error. For example, if a
stack overflow occurs, an error will arise.
They are also ignored at the time of
compilation
44. Catching an Exception(2/2)
• Since Java 7 you can handle more than one
exceptions using a single catch block, this
feature simplifies the code
45. Finally block
• The finally block follows a try block or a catch
block. A finally block of code always executes,
irrespective of occurrence of an Exception
• Using a finally block allows you to run any
cleanup-type statements that you want to
execute, no matter what happens in the
protected code
48. Java I/O
• Java I/O (Input and Output) is used to process
the input and produce the output based on
the input
• Java uses the concept of stream to make I/O
operation fast. The java.io package contains
all the classes required for input and output
operations
49. Stream
• A stream is a sequence of data. In Java a
stream is composed of bytes.
• In java, 3 streams are created for us
automatically. All these streams are attached
with console:
1. System.out: standard output stream
2. System.in: standard input stream
3. System.err: standard error stream
51. OutputStream class
• OutputStream class is an abstract class. It is
the superclass of all classes representing an
output stream of bytes. An output stream
accepts output bytes and sends them to some
sink
public void write(int)throws IOException:
is used to write a byte to the current
output stream.
public void write(byte[])throws
IOException:
is used to write an array of byte to the
current output stream.
public void flush()throws IOException: flushes the current output stream.
public void close()throws IOException:
is used to close the current output
stream.
52.
53. InputStream class
• InputStream class is an abstract class. It is the
superclass of all classes representing an input
stream of bytes.
public abstract int read()throws
IOException:
reads the next byte of data from the input
stream.It returns -1 at the end of file.
public int available()throws IOException:
returns an estimate of the number of
bytes that can be read from the current
input stream.
public void close()throws IOException: is used to close the current input stream.
54.
55. When to use what?
• For simple and primitive reads and writes, use
FileInputStream and FileOutputStream
• For writing byte array into multiple files, use
ByteArrayOutputStream and ByteArrayInputStream
• For reading data from multiple streams, use
SequenceInputStream
• Java FileWriter and FileReader classes are used to
write and read data from text files.
• Java Buffered Stream classes uses an internal buffer to
store data. It adds more efficiency than to write data
directly into a stream. So, it makes the performance
fast.
57. Serialization in Java
• Serialization in java is a mechanism of writing
the state of an object into a byte stream
• The reverse operation of serialization is called
deserialization.