The document discusses defensive programming and exception handling in object oriented programming. It defines defensive programming as a server object validating parameter values from client requests to prevent incorrect usage. Exception handling involves catching and responding to errors during program execution. The key points covered include checking parameter values, notifying clients of errors, exception hierarchies, and throwing and handling exceptions.
The document discusses various .NET debugging techniques, including:
1. The importance of debugging and the tools available for debugging .NET applications, such as Visual Studio and Debugging Tools for Windows.
2. Basic debugging tasks like setting breakpoints, stepping through code, and examining variables and call stacks.
3. Advanced techniques like debugging managed code, threads, and memory issues.
There are three types of errors in programming: syntax errors, run-time errors, and logic errors. Syntax errors occur when code violates rules and prevent programs from running. Run-time errors are unpredictable and can be trapped using error handling. Logic errors produce unexpected results and are hardest to find, requiring debugging tools. Visual Basic provides debugging aids like breakpoints, stepping, and watch expressions to help locate logic errors.
The finally clause in Java is used to specify code that is always executed regardless of whether an exception is thrown or caught in the try block. Clean-up code, like closing an open file or database connection, is commonly placed in a finally block to ensure it runs even if an exception occurs.
Exception is an error event that can occur during program execution and disrupt normal flow. Java provides try, catch, throw, throws and finally keywords to handle exceptions. try is used to mark code that might throw exceptions, catch handles exceptions, throw throws exceptions, throws declares exceptions a method can throw, and finally always executes. There are two types of exceptions - checked exceptions which must be caught or declared thrown, and runtime exceptions which do not require handling. The Throwable class is at the top of the exception hierarchy, with Error and Exception subclasses.
The way static analyzers fight against false positives, and why they do itPVS-Studio
In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment that the analyzer treats as a special case, and deliberately doesn't issue a warning for. To be honest, I didn't expect such an overflow of comments regarding the fact that an analyzer may not issue warnings because of the mechanisms of false positive elimination. In general the topic of battling against false positives is such a huge part of any static analyzer that it's really not clear what we can discuss here; but still, let's talk about it. Such mechanisms exist not only in our analyzer but also in another analyzers/compilers. Nevertheless, if this topic brought about so much discussion, I think it's worth talking about, and so I wrote this explanatory article.
Exception handling in C++ allows programs to handle errors and exceptions gracefully. try blocks enclose code that could throw exceptions, and catch blocks handle specific exception types. If an exception is thrown but not caught, stack unwinding destroys local variables and searches for an outer catch block. Exceptions remove error handling code from the normal flow and allow programs to recover, hide or ignore exceptions.
The document discusses effective use of exception handling in Java. It defines exceptions as abnormal conditions that occur during method execution. There are several types of exceptions, including checked exceptions that must be caught or declared, and unchecked exceptions that do not require handling. The document provides guidance on when to use checked vs unchecked exceptions and discusses approaches for designing exception handling in applications.
This is the material that I prepared for gathering best practices in exception handling that we aim to follow. I used the content stated in the references section.
The document discusses various .NET debugging techniques, including:
1. The importance of debugging and the tools available for debugging .NET applications, such as Visual Studio and Debugging Tools for Windows.
2. Basic debugging tasks like setting breakpoints, stepping through code, and examining variables and call stacks.
3. Advanced techniques like debugging managed code, threads, and memory issues.
There are three types of errors in programming: syntax errors, run-time errors, and logic errors. Syntax errors occur when code violates rules and prevent programs from running. Run-time errors are unpredictable and can be trapped using error handling. Logic errors produce unexpected results and are hardest to find, requiring debugging tools. Visual Basic provides debugging aids like breakpoints, stepping, and watch expressions to help locate logic errors.
The finally clause in Java is used to specify code that is always executed regardless of whether an exception is thrown or caught in the try block. Clean-up code, like closing an open file or database connection, is commonly placed in a finally block to ensure it runs even if an exception occurs.
Exception is an error event that can occur during program execution and disrupt normal flow. Java provides try, catch, throw, throws and finally keywords to handle exceptions. try is used to mark code that might throw exceptions, catch handles exceptions, throw throws exceptions, throws declares exceptions a method can throw, and finally always executes. There are two types of exceptions - checked exceptions which must be caught or declared thrown, and runtime exceptions which do not require handling. The Throwable class is at the top of the exception hierarchy, with Error and Exception subclasses.
The way static analyzers fight against false positives, and why they do itPVS-Studio
In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment that the analyzer treats as a special case, and deliberately doesn't issue a warning for. To be honest, I didn't expect such an overflow of comments regarding the fact that an analyzer may not issue warnings because of the mechanisms of false positive elimination. In general the topic of battling against false positives is such a huge part of any static analyzer that it's really not clear what we can discuss here; but still, let's talk about it. Such mechanisms exist not only in our analyzer but also in another analyzers/compilers. Nevertheless, if this topic brought about so much discussion, I think it's worth talking about, and so I wrote this explanatory article.
Exception handling in C++ allows programs to handle errors and exceptions gracefully. try blocks enclose code that could throw exceptions, and catch blocks handle specific exception types. If an exception is thrown but not caught, stack unwinding destroys local variables and searches for an outer catch block. Exceptions remove error handling code from the normal flow and allow programs to recover, hide or ignore exceptions.
The document discusses effective use of exception handling in Java. It defines exceptions as abnormal conditions that occur during method execution. There are several types of exceptions, including checked exceptions that must be caught or declared, and unchecked exceptions that do not require handling. The document provides guidance on when to use checked vs unchecked exceptions and discusses approaches for designing exception handling in applications.
This is the material that I prepared for gathering best practices in exception handling that we aim to follow. I used the content stated in the references section.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
This document discusses debugging basics, including the types of errors that can occur (syntax vs semantic), common debugging tools in Visual Studio like breakpoints and stepping through code, differences between debug and release builds, and using conditional attributes and blocks to include debugging code only in debug builds. It also mentions just-in-time debugging and new tools like BrowserStack for cross-browser debugging.
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...Andrey Karpov
A Zero-day (0-day) vulnerability is a computer-software vulnerability introduced during the development process and not yet discovered by the developers. Zero-day vulnerabilities can be exploited by hackers, thus affecting the company's reputation. Developers should seek to minimize the number of defects leading to such vulnerabilities. PVS-Studio, a static code analyzer for C, C++, C#, and Java code, is one of the tools capable of detecting security issues.
Exceptions indicate problems during program execution and can be handled to allow programs to continue running or notify users. There are different levels where exceptions can occur including hardware, operating systems, languages, and within programs. Exception handling uses try, catch, and throw blocks. A try block encloses code that could throw an exception. If an exception occurs, control transfers to the matching catch block. The catch block handles the exception to resolve it. Exceptions not caught will terminate the program.
The document discusses Visual Studio's live static code analysis feature. It explains that this feature analyzes code in real-time as it is written, without requiring compilation, to detect errors and potential issues based on installed code analyzers. The document demonstrates how to install and use code analyzers through examples, showing how analyzers detect issues and provide suggestions to fix problems directly in the code editor through light bulb notifications. It provides a case study walking through fixing various issues detected in sample code using suggestions from an analyzer to iteratively improve the code quality.
When developing web applications with PHP and MySQL, errors can occur in the HTML, PHP code, SQL queries, or MySQL. To debug issues, first determine the problem area. Common PHP errors include logical errors, runtime errors, and syntactical errors. SQL errors are usually due to incorrect syntax. Debugging techniques include checking that the correct page is being run, saving changes, using the URL to run PHP pages, displaying PHP errors, logging errors to files, and commenting out lines of code.
The document provides an overview of exception handling in Java. It discusses the key concepts like try, catch, throw, throws and finally blocks. Exceptions can be checked, unchecked or errors. Checked exceptions must be declared or handled while unchecked occur due to programming errors. The try block contains code that might throw exceptions. Corresponding catch blocks handle specific exception types. Finally blocks contain cleanup code that always executes.
The document discusses exception handling in Java programming. It covers the basics of exceptions, using try/catch blocks, throwing and catching multiple exceptions, and the finally block. It also discusses advantages of exception handling, specifying exceptions methods can throw, tracing exceptions through the call stack, creating custom exceptions, and using assertions. The key topics are exceptions, try/catch/finally, throwing exceptions, and creating and handling exceptions.
Manual testing interview question by INFOTECHPravinsinh
The document provides answers to various questions related to manual software testing practices. It discusses key concepts like priority and severity levels of defects, examples of high severity low priority defects. It also covers the basis for test case review, contents of requirements documents, differences between web and client-server application testing, defect life cycle, and techniques for test plan preparation. The document is a guide for manual testers that aims to enhance their understanding of software testing concepts and best practices.
Mocking allows you to test classes and methods in isolation by replacing their collaborators with mock objects that simulate the normal environment. EasyMock is a framework for creating mock objects that uses a record/replay approach where you first define the expected behavior of mock objects and then replay the code under test to verify it behaves as expected. Mock objects can be normal, strict, or nice depending on how strictly they enforce the expected behavior and order of method calls.
Exceptions are a powerful mechanism for centralized processing of errors and exceptional situations. This mechanism replaces the procedure-oriented method of error handling in which each function returns a code indicating an error or a successful execution.
Testdriven Development using JUnit and EasyMockschlebu
This document discusses test-driven development using JUnit and EasyMock. It introduces test-driven development and mocking, describes how to define expectations and replay mocks using EasyMock, and provides an example demonstration. The summary emphasizes that test-driven development helps write better tests while removing tediousness, and mocking is a useful tool for unit testing that has some technical limitations.
This document provides an overview of using EasyMock, an open source Java testing framework, to create mock objects for unit testing. It discusses how mocking objects can improve testability by removing dependencies. EasyMock allows specifying expected method calls and return values to simulate object behavior. Tests can then verify mocks were used as expected. The document demonstrates creating mocks, setting expectations, replaying mocks, and verifying expectations with EasyMock.
The document discusses various aspects of unit testing including definitions, benefits, naming standards, and best practices. It provides definitions for terms like error, defect, failure. It outlines the benefits of unit testing like finding bugs early, enabling code refactoring. It discusses what should be tested like boundaries, error conditions. It also provides examples of good test names and guidelines for structuring and naming unit tests.
Software testing is a vital process without which no software release can occur, it makes the software usable. Software testing offers opportunities constantly to be exposed with new development methods, new platform technologies, new product innovations.
JAVA EXCEPTION HANDLING
N.V.Raja Sekhar Reddy
www.technolamp.co.in
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
This document discusses error handling in VBScript. It defines key terminology like faults, errors, failures, detectors, and exceptions. It explains the purpose of error handling to make software more reliable and protect systems from unacceptable behavior during errors. It also covers the On Error statement and its Resume Next and GoTo 0 options for controlling error handling. On Error Resume Next allows code to continue after errors but can mask problems, so careful debugging is required.
Three key points about exception handling in C++ are:
1. Exceptions are used to handle runtime errors or exceptions and allow a program to continue running or exit gracefully rather than crashing.
2. Exception handling uses the try, throw, and catch keywords where code that can throw exceptions is wrapped in a try block, exceptions are thrown using throw, and catch blocks catch the exceptions.
3. When an exception is thrown in a try block, it bubbles up the call stack until a catch block that matches the exception type is found, allowing the exception to be handled.
The document discusses object oriented programming using C++. It covers the course objectives, which are to enable students to understand C++ constructs and relate them to engineering problems, and to improve their ability to analyze and address programming problems. It also lists the course outcomes and evaluation scheme. The content section defines exceptions, discusses exception handling using try, throw and catch, and covers the advantages and mechanism of exception handling. It provides examples of try-catch blocks and explains how to use exception handling in functions. Key applications of exception handling are also discussed.
This document contains lecture notes on error handling in Visual Basic .NET. It discusses the different types of errors that can occur, including syntax errors, logical errors, and run-time errors. It introduces exception handling in VB.NET using Try/Catch blocks to trap errors. Specific exception classes are described that can be used to trap different error types. Finally, it discusses using the Throw statement to raise custom exceptions. The notes provide an overview of using exceptions to prevent programs from crashing and make them more robust.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
This document discusses debugging basics, including the types of errors that can occur (syntax vs semantic), common debugging tools in Visual Studio like breakpoints and stepping through code, differences between debug and release builds, and using conditional attributes and blocks to include debugging code only in debug builds. It also mentions just-in-time debugging and new tools like BrowserStack for cross-browser debugging.
PVS-Studio Static Analyzer as a Tool for Protection against Zero-Day Vulnerab...Andrey Karpov
A Zero-day (0-day) vulnerability is a computer-software vulnerability introduced during the development process and not yet discovered by the developers. Zero-day vulnerabilities can be exploited by hackers, thus affecting the company's reputation. Developers should seek to minimize the number of defects leading to such vulnerabilities. PVS-Studio, a static code analyzer for C, C++, C#, and Java code, is one of the tools capable of detecting security issues.
Exceptions indicate problems during program execution and can be handled to allow programs to continue running or notify users. There are different levels where exceptions can occur including hardware, operating systems, languages, and within programs. Exception handling uses try, catch, and throw blocks. A try block encloses code that could throw an exception. If an exception occurs, control transfers to the matching catch block. The catch block handles the exception to resolve it. Exceptions not caught will terminate the program.
The document discusses Visual Studio's live static code analysis feature. It explains that this feature analyzes code in real-time as it is written, without requiring compilation, to detect errors and potential issues based on installed code analyzers. The document demonstrates how to install and use code analyzers through examples, showing how analyzers detect issues and provide suggestions to fix problems directly in the code editor through light bulb notifications. It provides a case study walking through fixing various issues detected in sample code using suggestions from an analyzer to iteratively improve the code quality.
When developing web applications with PHP and MySQL, errors can occur in the HTML, PHP code, SQL queries, or MySQL. To debug issues, first determine the problem area. Common PHP errors include logical errors, runtime errors, and syntactical errors. SQL errors are usually due to incorrect syntax. Debugging techniques include checking that the correct page is being run, saving changes, using the URL to run PHP pages, displaying PHP errors, logging errors to files, and commenting out lines of code.
The document provides an overview of exception handling in Java. It discusses the key concepts like try, catch, throw, throws and finally blocks. Exceptions can be checked, unchecked or errors. Checked exceptions must be declared or handled while unchecked occur due to programming errors. The try block contains code that might throw exceptions. Corresponding catch blocks handle specific exception types. Finally blocks contain cleanup code that always executes.
The document discusses exception handling in Java programming. It covers the basics of exceptions, using try/catch blocks, throwing and catching multiple exceptions, and the finally block. It also discusses advantages of exception handling, specifying exceptions methods can throw, tracing exceptions through the call stack, creating custom exceptions, and using assertions. The key topics are exceptions, try/catch/finally, throwing exceptions, and creating and handling exceptions.
Manual testing interview question by INFOTECHPravinsinh
The document provides answers to various questions related to manual software testing practices. It discusses key concepts like priority and severity levels of defects, examples of high severity low priority defects. It also covers the basis for test case review, contents of requirements documents, differences between web and client-server application testing, defect life cycle, and techniques for test plan preparation. The document is a guide for manual testers that aims to enhance their understanding of software testing concepts and best practices.
Mocking allows you to test classes and methods in isolation by replacing their collaborators with mock objects that simulate the normal environment. EasyMock is a framework for creating mock objects that uses a record/replay approach where you first define the expected behavior of mock objects and then replay the code under test to verify it behaves as expected. Mock objects can be normal, strict, or nice depending on how strictly they enforce the expected behavior and order of method calls.
Exceptions are a powerful mechanism for centralized processing of errors and exceptional situations. This mechanism replaces the procedure-oriented method of error handling in which each function returns a code indicating an error or a successful execution.
Testdriven Development using JUnit and EasyMockschlebu
This document discusses test-driven development using JUnit and EasyMock. It introduces test-driven development and mocking, describes how to define expectations and replay mocks using EasyMock, and provides an example demonstration. The summary emphasizes that test-driven development helps write better tests while removing tediousness, and mocking is a useful tool for unit testing that has some technical limitations.
This document provides an overview of using EasyMock, an open source Java testing framework, to create mock objects for unit testing. It discusses how mocking objects can improve testability by removing dependencies. EasyMock allows specifying expected method calls and return values to simulate object behavior. Tests can then verify mocks were used as expected. The document demonstrates creating mocks, setting expectations, replaying mocks, and verifying expectations with EasyMock.
The document discusses various aspects of unit testing including definitions, benefits, naming standards, and best practices. It provides definitions for terms like error, defect, failure. It outlines the benefits of unit testing like finding bugs early, enabling code refactoring. It discusses what should be tested like boundaries, error conditions. It also provides examples of good test names and guidelines for structuring and naming unit tests.
Software testing is a vital process without which no software release can occur, it makes the software usable. Software testing offers opportunities constantly to be exposed with new development methods, new platform technologies, new product innovations.
JAVA EXCEPTION HANDLING
N.V.Raja Sekhar Reddy
www.technolamp.co.in
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
This document discusses error handling in VBScript. It defines key terminology like faults, errors, failures, detectors, and exceptions. It explains the purpose of error handling to make software more reliable and protect systems from unacceptable behavior during errors. It also covers the On Error statement and its Resume Next and GoTo 0 options for controlling error handling. On Error Resume Next allows code to continue after errors but can mask problems, so careful debugging is required.
Three key points about exception handling in C++ are:
1. Exceptions are used to handle runtime errors or exceptions and allow a program to continue running or exit gracefully rather than crashing.
2. Exception handling uses the try, throw, and catch keywords where code that can throw exceptions is wrapped in a try block, exceptions are thrown using throw, and catch blocks catch the exceptions.
3. When an exception is thrown in a try block, it bubbles up the call stack until a catch block that matches the exception type is found, allowing the exception to be handled.
The document discusses object oriented programming using C++. It covers the course objectives, which are to enable students to understand C++ constructs and relate them to engineering problems, and to improve their ability to analyze and address programming problems. It also lists the course outcomes and evaluation scheme. The content section defines exceptions, discusses exception handling using try, throw and catch, and covers the advantages and mechanism of exception handling. It provides examples of try-catch blocks and explains how to use exception handling in functions. Key applications of exception handling are also discussed.
This document contains lecture notes on error handling in Visual Basic .NET. It discusses the different types of errors that can occur, including syntax errors, logical errors, and run-time errors. It introduces exception handling in VB.NET using Try/Catch blocks to trap errors. Specific exception classes are described that can be used to trap different error types. Finally, it discusses using the Throw statement to raise custom exceptions. The notes provide an overview of using exceptions to prevent programs from crashing and make them more robust.
This document summarizes a lecture on error handling and debugging in C# visual programming. It discusses using try, catch, and finally blocks to handle errors through exceptions. It also covers debugging techniques like using breakpoints to step through code. Common .NET exception classes are listed, and reasons for debugging like ensuring reliable software are provided.
Exception handling in Java provides a robust way to handle errors and exceptions that occur during program execution. The try-catch block allows code to be wrapped in a try block to protect it, while catch blocks handle any exceptions. Multiple catch blocks can be used to handle different exception types. The throw keyword is used to manually throw an exception, while throws is used to indicate unhandled exceptions in a method signature. Finally, the finally block is used for cleanup and always executes regardless of exceptions.
The document discusses exception handling in Java. It defines exceptions as events that prevent an action from completing as intended. There are three types of exceptions: errors thrown by the JVM, runtime exceptions for logical errors, and checked exceptions for external issues. The try-catch block is used to handle exceptions, with catch blocks for specific exception types and finally for cleanup. Custom exceptions can be created by extending the Exception class.
The document provides answers to various manual testing questions and examples. It discusses key concepts like priority and severity, examples of high severity low priority defects and vice versa. It also covers test case review criteria, contents of requirements documents, differences between web and client-server testing, test plan contents, defect lifecycle, regression testing approach, and how to report defects in an excel sheet.
Exception is an error event that can occur during program execution and disrupt normal flow. Java provides try, catch, throw, throws and finally keywords to handle exceptions. try is used to mark code that might throw exceptions, catch handles exceptions, throw throws exceptions, throws declares exceptions a method can throw, and finally always executes. There are two categories of exceptions - checked exceptions which must be caught or declared thrown, and runtime exceptions which do not require handling.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
Dependable Software Development in Software Engineering SE18koolkampus
The document discusses techniques for developing dependable software systems, including fault avoidance, fault tolerance, and fault removal. It covers structured programming, error-prone constructs, information hiding, exceptions, fault detection, damage assessment, recovery approaches, and fault-tolerant architectures using hardware and software redundancy. Key aspects are avoiding errors during development, detecting and handling faults at runtime, and designing systems that can continue operating despite failures.
The document discusses error and exception handling in UiPath Studio. It defines different types of errors like syntax errors and exceptions. Exceptions are events caught and handled by the program. Common exceptions that may occur in UiPath projects are discussed, including NullReferenceException, IndexOutOfRangeException, and SelectorNotFoundException. The document also covers different exception handling techniques in UiPath like TryCatch, Throw, Rethrow, and the ContinueOnError property. Finally, it discusses the Global Exception Handler used to handle unexpected exceptions.
Types of Exceptionsfsfsfsdfsdfdsfsfsdfsdssuserce9e9d
It explains about the fsdfsdfsdfsfsdfsdfsdfsdfsdfsdfsdfsssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
ASP.NET 05 - Exception Handling And Validation ControlsRandy Connolly
Exception handling in ASP.NET allows applications to gracefully handle errors using try-catch blocks to handle exceptions at the class level, the Page_Error event to handle errors at the page level, and the Application_Error event to handle errors globally. Validation controls like RequiredFieldValidator and CompareValidator validate user input on both the client-side and server-side to ensure proper data and reduce round trips to the server. Custom error pages can be configured in the Web.config file to handle different HTTP error codes like 404 and 500 errors.
Manualtestinginterviewquestionbyinfotech 100901071035-phpapp01Anshuman Rai
The document provides information about manual software testing concepts including priority and severity levels, examples of high severity low priority defects, bases for test case review, contents of requirements documents, differences between web and client-server testing, and bug lifecycles. It also includes answers to common testing questions and examples of test cases for a basic calculator application.
Manual testing interview questions by infotech suhasreddy1
The document provides information about manual software testing practices including definitions of priority and severity for defects, examples of high severity low priority defects, bases for test case review, contents of requirements documents, differences between web application and client server testing, examples of defect reporting, bug lifecycles, and approaches to regression testing. Key details covered include assigning priority by developers and severity by testers, focusing regression testing on modules impacted by fixes, and updating test cases based on changes to functionality or code.
This document discusses exception handling in Java. It defines what exceptions are, why they occur, and what exception handling is. It describes the advantages of exception handling and differences between exceptions and errors. It covers the exception class hierarchy and exception handling keywords like try, catch, finally, throw, and throws. It provides examples of common exception types and an example Java code demonstrating exception handling.
This document discusses different types of errors in VB.net and methods for debugging them. It describes syntax errors, runtime errors, and logic errors. It then provides details on debugging techniques for each error type, such as using breakpoints, stepping through code, and monitoring variable values. Finally, it discusses error handling techniques like validating user input, activating error trapping with labels and exceptions, and testing to catch logic errors.
The document discusses multithreading and concurrency in Java. It begins with an introduction to multithreading, explaining that Java allows concurrent execution through multiple thread contexts. It then discusses thread states and lifecycles, as well as challenges with multithreaded programming. The document provides examples of creating threads by implementing the Runnable interface and using Executor frameworks to manage thread pools. It includes code samples for creating PrintTasks as Runnable objects and using an ExecutorService to execute them concurrently.
The document discusses user defined exceptions and assertion statements in Java. It provides examples of how to create a custom exception class that extends the Exception class, and how to throw that exception from a method. It also explains how to write assertion statements to verify assumptions, including the simple and complex forms. Assertions fail if the expression is false, and can provide a message in the complex form.
The document discusses object oriented programming and packages in Java. It defines what a package is and explains that packages are used to organize related classes and interfaces. The document outlines the advantages of using packages and describes the different types of packages such as predefined and user-defined packages. It provides rules for creating user-defined packages and examples of package programs with explanations of compiling and executing package code. The document also discusses importing packages and compares the differences between packages and inheritance.
The document discusses abstract classes, abstract methods, and interfaces in object-oriented programming. It defines abstract classes as classes declared with the abstract keyword that can contain both defined and undefined methods. Abstract methods only contain declarations without a body. Interfaces are similar to classes but can only contain abstract methods and final static variables. The key differences between interfaces and classes are that interfaces cannot be instantiated, do not have constructors, and all methods are implicitly abstract. Interfaces are used to achieve abstraction and multiple inheritance in Java.
The document discusses polymorphism and object-oriented programming concepts. It defines polymorphism as an object taking on many forms, and describes how it occurs through parent and child class relationships in Java. The key points are:
- Polymorphism allows a parent class reference to refer to a child class object.
- Static type refers to a reference variable's type, while dynamic type refers to the actual object's type. Dynamic binding means the method called is based on the object's dynamic type.
- Subclasses can override methods to achieve polymorphic behavior like with the display() method.
- Access modifiers like private, public, and protected determine method/field accessibility in subclasses.
- Final methods
This lecture discusses inheritance in object-oriented programming. It begins with an introduction to inheritance and why it is used. Inheritance allows classes to inherit properties like methods and fields from a parent or superclass. This avoids duplicating code and allows code reuse. The lecture then provides the syntax for inheritance in Java and gives an example to demonstrate inheritance. It shows how a subclass inherits from a superclass. The lecture ends by discussing some important points about inheritance in Java like how subclasses can override methods.
The document discusses various topics related to object oriented programming in Java including arrays, foreach loops, collection classes like ArrayList, and differences between generic and non-generic collections. It provides examples of how to create and use arrays, foreach loops, ArrayList to store and retrieve elements, commonly used ArrayList methods, and advantages of generic collections over non-generic collections in Java.
This document discusses object-oriented programming concepts like object interaction, abstraction, and modularization. It provides an example of modeling a digital clock using these concepts. The clock can be divided into modular subcomponents like a hours display and minutes display. These can be implemented as separate NumberDisplay objects that handle incrementing values and rolling over limits. This demonstrates abstraction by hiding implementation details and focusing on the key behaviors. Overall, the document shows how object-oriented design principles can be applied to break a problem into cooperative and interacting objects.
This document summarizes a lecture on object-oriented programming concepts including classes, methods, constructors, and objects.
The lecture covered:
1) The components of a class including fields, methods, and constructors. Main(), setter, and getter methods were discussed.
2) How to call methods within the same class and between different classes.
3) How to create objects from classes and how messages are sent to objects to invoke their methods.
This document discusses visual perception and the processes of sensation and perception. It defines sensation as the passive process of bringing external information to the brain through the senses. Perception is defined as the active process of selecting, organizing, and interpreting sensory information. The document outlines different approaches to perception, including bottom-up stimulus-driven perception, top-down goal-driven perception based on knowledge and expectations, and interactive perception involving both processes. It also discusses theories of bottom-up perception, object perception from viewer-centered and object-centered perspectives, Gestalt laws of patterns and forms perception, and depth perception.
This document provides an overview of maps and the HashMap data structure in Java. It discusses that a map stores key-value pairs instead of using indexes like an ArrayList. HashMap uses a hashtable to implement the Map interface efficiently. The document demonstrates how to use HashMap by inserting, looking up, and removing entries from a phone book example. It also discusses that duplicate keys are not allowed in HashMap and will replace existing values, and how to check the total number of entries.
Cognitive psychology is the study of mental processes such as attention, memory, perception, problem solving and thinking. It developed as a field in response to behaviorism, which could not adequately explain complex human behaviors and abilities like language use. Cognitive psychologists study topics like how people learn and remember information, perceive different shapes, and acquire language. Understanding cognition can help fields like education, medicine, AI and interface design. The human mind is complex and cognition involves acquiring, storing, retrieving and processing knowledge.
The document discusses a lecture on object-oriented programming. It covers key topics like classes, objects, fields, methods, constructors, and creating objects from classes. It provides examples of how to define classes with fields, methods, and constructors. It also explains how to compile and run a simple Java program with a main method.
This lecture covered object-oriented programming concepts of inheritance and polymorphism:
Inheritance allows new objects to take on properties of existing objects in a hierarchy. It was defined and real-world examples like mobile phones and vehicles were provided. Key inheritance terms like superclass, subclass, and relationships like "is-a-kind-of" and "is-a" were explained.
Polymorphism is the ability of an object to take on many forms. It allows sending the same message to objects of different classes and having the objects respond differently. Advantages are flexibility and reusability.
The document discusses key concepts of object-oriented programming including information hiding, encapsulation, interfaces, implementation, abstraction, and messages. It provides examples and definitions for each concept. Information hiding and encapsulation are achieved through making an object's state and behavior private and only accessible through its methods. An interface defines the methods an object exposes to others while implementation refers to the internal logic and data structures. Abstraction focuses on relevant properties and ignores irrelevant details, allowing for simplified models.
This lecture introduces object-oriented programming concepts. It discusses what object orientation is, how it models real-world problems using objects that have states and behaviors. The key concepts of OOP like encapsulation, inheritance and polymorphism are explained. The lecture also covers what an object is, different types of objects and examples. It defines object-oriented programming as a methodology to structure programs around objects and classes. The course contents and evaluation criteria are outlined. Finally, it demonstrates how to install JDK on a system to get started with Java programming.
Phenomics assisted breeding in crop improvementIshaGoswami9
As the population is increasing and will reach about 9 billion upto 2050. Also due to climate change, it is difficult to meet the food requirement of such a large population. Facing the challenges presented by resource shortages, climate
change, and increasing global population, crop yield and quality need to be improved in a sustainable way over the coming decades. Genetic improvement by breeding is the best way to increase crop productivity. With the rapid progression of functional
genomics, an increasing number of crop genomes have been sequenced and dozens of genes influencing key agronomic traits have been identified. However, current genome sequence information has not been adequately exploited for understanding
the complex characteristics of multiple gene, owing to a lack of crop phenotypic data. Efficient, automatic, and accurate technologies and platforms that can capture phenotypic data that can
be linked to genomics information for crop improvement at all growth stages have become as important as genotyping. Thus,
high-throughput phenotyping has become the major bottleneck restricting crop breeding. Plant phenomics has been defined as the high-throughput, accurate acquisition and analysis of multi-dimensional phenotypes
during crop growing stages at the organism level, including the cell, tissue, organ, individual plant, plot, and field levels. With the rapid development of novel sensors, imaging technology,
and analysis methods, numerous infrastructure platforms have been developed for phenotyping.
Current Ms word generated power point presentation covers major details about the micronuclei test. It's significance and assays to conduct it. It is used to detect the micronuclei formation inside the cells of nearly every multicellular organism. It's formation takes place during chromosomal sepration at metaphase.
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...University of Maribor
Slides from talk:
Aleš Zamuda: Remote Sensing and Computational, Evolutionary, Supercomputing, and Intelligent Systems.
11th International Conference on Electrical, Electronics and Computer Engineering (IcETRAN), Niš, 3-6 June 2024
Inter-Society Networking Panel GRSS/MTT-S/CIS Panel Session: Promoting Connection and Cooperation
https://www.etran.rs/2024/en/home-english/
EWOCS-I: The catalog of X-ray sources in Westerlund 1 from the Extended Weste...Sérgio Sacani
Context. With a mass exceeding several 104 M⊙ and a rich and dense population of massive stars, supermassive young star clusters
represent the most massive star-forming environment that is dominated by the feedback from massive stars and gravitational interactions
among stars.
Aims. In this paper we present the Extended Westerlund 1 and 2 Open Clusters Survey (EWOCS) project, which aims to investigate
the influence of the starburst environment on the formation of stars and planets, and on the evolution of both low and high mass stars.
The primary targets of this project are Westerlund 1 and 2, the closest supermassive star clusters to the Sun.
Methods. The project is based primarily on recent observations conducted with the Chandra and JWST observatories. Specifically,
the Chandra survey of Westerlund 1 consists of 36 new ACIS-I observations, nearly co-pointed, for a total exposure time of 1 Msec.
Additionally, we included 8 archival Chandra/ACIS-S observations. This paper presents the resulting catalog of X-ray sources within
and around Westerlund 1. Sources were detected by combining various existing methods, and photon extraction and source validation
were carried out using the ACIS-Extract software.
Results. The EWOCS X-ray catalog comprises 5963 validated sources out of the 9420 initially provided to ACIS-Extract, reaching a
photon flux threshold of approximately 2 × 10−8 photons cm−2
s
−1
. The X-ray sources exhibit a highly concentrated spatial distribution,
with 1075 sources located within the central 1 arcmin. We have successfully detected X-ray emissions from 126 out of the 166 known
massive stars of the cluster, and we have collected over 71 000 photons from the magnetar CXO J164710.20-455217.
When I was asked to give a companion lecture in support of ‘The Philosophy of Science’ (https://shorturl.at/4pUXz) I decided not to walk through the detail of the many methodologies in order of use. Instead, I chose to employ a long standing, and ongoing, scientific development as an exemplar. And so, I chose the ever evolving story of Thermodynamics as a scientific investigation at its best.
Conducted over a period of >200 years, Thermodynamics R&D, and application, benefitted from the highest levels of professionalism, collaboration, and technical thoroughness. New layers of application, methodology, and practice were made possible by the progressive advance of technology. In turn, this has seen measurement and modelling accuracy continually improved at a micro and macro level.
Perhaps most importantly, Thermodynamics rapidly became a primary tool in the advance of applied science/engineering/technology, spanning micro-tech, to aerospace and cosmology. I can think of no better a story to illustrate the breadth of scientific methodologies and applications at their best.
The debris of the ‘last major merger’ is dynamically youngSérgio Sacani
The Milky Way’s (MW) inner stellar halo contains an [Fe/H]-rich component with highly eccentric orbits, often referred to as the
‘last major merger.’ Hypotheses for the origin of this component include Gaia-Sausage/Enceladus (GSE), where the progenitor
collided with the MW proto-disc 8–11 Gyr ago, and the Virgo Radial Merger (VRM), where the progenitor collided with the
MW disc within the last 3 Gyr. These two scenarios make different predictions about observable structure in local phase space,
because the morphology of debris depends on how long it has had to phase mix. The recently identified phase-space folds in Gaia
DR3 have positive caustic velocities, making them fundamentally different than the phase-mixed chevrons found in simulations
at late times. Roughly 20 per cent of the stars in the prograde local stellar halo are associated with the observed caustics. Based
on a simple phase-mixing model, the observed number of caustics are consistent with a merger that occurred 1–2 Gyr ago.
We also compare the observed phase-space distribution to FIRE-2 Latte simulations of GSE-like mergers, using a quantitative
measurement of phase mixing (2D causticality). The observed local phase-space distribution best matches the simulated data
1–2 Gyr after collision, and certainly not later than 3 Gyr. This is further evidence that the progenitor of the ‘last major merger’
did not collide with the MW proto-disc at early times, as is thought for the GSE, but instead collided with the MW disc within
the last few Gyr, consistent with the body of work surrounding the VRM.
Authoring a personal GPT for your research and practice: How we created the Q...Leonel Morgado
Thematic analysis in qualitative research is a time-consuming and systematic task, typically done using teams. Team members must ground their activities on common understandings of the major concepts underlying the thematic analysis, and define criteria for its development. However, conceptual misunderstandings, equivocations, and lack of adherence to criteria are challenges to the quality and speed of this process. Given the distributed and uncertain nature of this process, we wondered if the tasks in thematic analysis could be supported by readily available artificial intelligence chatbots. Our early efforts point to potential benefits: not just saving time in the coding process but better adherence to criteria and grounding, by increasing triangulation between humans and artificial intelligence. This tutorial will provide a description and demonstration of the process we followed, as two academic researchers, to develop a custom ChatGPT to assist with qualitative coding in the thematic data analysis process of immersive learning accounts in a survey of the academic literature: QUAL-E Immersive Learning Thematic Analysis Helper. In the hands-on time, participants will try out QUAL-E and develop their ideas for their own qualitative coding ChatGPT. Participants that have the paid ChatGPT Plus subscription can create a draft of their assistants. The organizers will provide course materials and slide deck that participants will be able to utilize to continue development of their custom GPT. The paid subscription to ChatGPT Plus is not required to participate in this workshop, just for trying out personal GPTs during it.
The technology uses reclaimed CO₂ as the dyeing medium in a closed loop process. When pressurized, CO₂ becomes supercritical (SC-CO₂). In this state CO₂ has a very high solvent power, allowing the dye to dissolve easily.
PPT on Direct Seeded Rice presented at the three-day 'Training and Validation Workshop on Modules of Climate Smart Agriculture (CSA) Technologies in South Asia' workshop on April 22, 2024.
ESA/ACT Science Coffee: Diego Blas - Gravitational wave detection with orbita...Advanced-Concepts-Team
Presentation in the Science Coffee of the Advanced Concepts Team of the European Space Agency on the 07.06.2024.
Speaker: Diego Blas (IFAE/ICREA)
Title: Gravitational wave detection with orbital motion of Moon and artificial
Abstract:
In this talk I will describe some recent ideas to find gravitational waves from supermassive black holes or of primordial origin by studying their secular effect on the orbital motion of the Moon or satellites that are laser ranged.
The binding of cosmological structures by massless topological defectsSérgio Sacani
Assuming spherical symmetry and weak field, it is shown that if one solves the Poisson equation or the Einstein field
equations sourced by a topological defect, i.e. a singularity of a very specific form, the result is a localized gravitational
field capable of driving flat rotation (i.e. Keplerian circular orbits at a constant speed for all radii) of test masses on a thin
spherical shell without any underlying mass. Moreover, a large-scale structure which exploits this solution by assembling
concentrically a number of such topological defects can establish a flat stellar or galactic rotation curve, and can also deflect
light in the same manner as an equipotential (isothermal) sphere. Thus, the need for dark matter or modified gravity theory is
mitigated, at least in part.
3. Defensive Programming
What is Defensive Programming?
In a Client – Server Interaction where a server object only perform
activities on client request.
While writing server class, a programmer can adopt two possible
ways
1. They can assume that client objects will know what they are doing and
will request services only in a sensible and well-defined way.
2. They can assume that server objects will operate in an essentially
problematic environment in which all possible steps must be taken to
prevent client objects from using them incorrectly.
Extreme views
Practically, scenario lies some where in between
A third possibility, of course, is an intentionally hostile client who is trying
to break or find a weakness in the server. 3
4. Defensive Programming
Questions to Discuss
Different views - a useful base to discuss questions such as:
How much checking should a server’s methods perform on client
requests?
How should a server report errors to its clients?
How can a client anticipate failure of a request to a server?
How should a client deal with failure of a request?
So far we have written all the classes with implicit trust that client will use
these classes appropriately
4
5. Defensive Programming
Parameter Checking
A server object is most vulnerable when its constructor and methods
receive external values through their parameters.
The values passed to a constructor are used to set up an object’s initial
state, while the values passed to a method will be used to influence
the overall effect of the method call and may change the state of the
object and a result the method returns.
It is vital that a server object knows whether it can trust parameter
values to be valid or whether it needs to check their validity for itself.
5
6. Defensive Programming
Server Error Reporting
Having protected a server object from performing an illegal operation
through bad parameter values is all that the server writer needs to do.
Ideally we should like to avoid such error situations from arising in
the first place.
Furthermore, it is often the case that incorrect parameter values are
the result of some form of programming error in the client that
supplied them.
Therefore, rather than simply programming around the problem in
the server and leaving it at that, it is good practice for the server to
make some effort to indicate that a problem has arisen, either to the
client itself or to a human user or programmer.
Here we see three different nature of users
6
7. Defensive Programming
Notifying User
Print an error message
Two Problems with this Approach
1. They assume that the application is being used by a human user who will
see the error message. There are many applications that run completely
independently of a human user. An error message, or an error window,
will go completely unnoticed.
2. Even where there is a human user to see the error message, it will be rare
for that user to be in a position to do something about the problem.
Programs that print inappropriate error messages are more likely to annoy
their users rather than achieve a useful outcome.
Except in a very limited set of circumstances, notifying the user is not a
general solution to the problem of error reporting.
7
8. Defensive Programming
Notifying Client Object
There are two main ways to notify client object
1. A server can use a non-void return type (e.g boolean) of a method to
return a value that indicates either success or failure of the method call.
2. A server can throw an exception if something goes wrong.
8
9. Exceptions
What is an Exception?
An Exception is an event, which occurs during the execution of a program,
that disrupts the normal flow of the program's Instructions.
An exception can occur for many different reasons, below given are some
scenarios where exception occurs.
A user has entered invalid data.
A file that needs to be opened cannot be found.
A network connection has been lost in the middle of communications or
the JVM has run out of memory.
Some of these exceptions are caused by user error, others by programmer
error, and others by physical resources that have failed in some manner.
9
10. Exceptions
Three Categories of Exception
Checked Exception : A checked exception 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.
Unchecked Exception : An Unchecked exception 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.
Error: 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.
10
11. Exception Handling
What is Exception Handling?
The process of converting system error messages into user friendly error
message is known as Exception handling.
This is one of the powerful feature of Java to handle run time error and
maintain normal flow of java application.
11
13. Exception Handling
Methods with Description
public String getMessage()
Returns a detailed message about the exception that has occurred. This
message is initialized in the Throwable constructor
public Throwable getCause()
Returns the cause of the exception as represented by a Throwable object.
public String toString()
Returns the name of the class concatenated with the result of getMessage()
public void printStackTrace()
Prints the result of toString() along with the stack trace to System.err, the
error output stream.
There are more method, Google for better understanding of Exception
13
14. Exception Throwing
Throwing an Exception
Throwing an exception is the most effective way a server object has of
indicating that it is unable to fulfill a call on one of its methods.
One of the major advantages this has over using a special return value is that
it is (almost) impossible for a client to ignore the fact that an exception has
been thrown and carry on regardless.
Failure by the client to handle an exception will result in the application
terminating immediately.
In addition, the exception mechanism is independent of the return value of a
method, so it can be used for all methods, irrespective of the return type
An Exception is thrown using throw statement. 14
15. Exception Throwing
Throwing an Unchecked Exception Example
Here getDetails method is throwing an exception to indicate that passing a
nullvalue for the key does not make sense because it is not a valid key.
publicContactDetails getDetails(String key)
{
if(key == null){
throw new IllegalArgumentException(
"null key in getDetails");
}
return book.get(key);
}
15
16. Exception Throwing
Throwing Exception Principles
Exception Mechanism is independent of the return value of method, so it can
be used for all methods, irrespective of all return types
The place where an error is discovered will be distinct from where recovery is
attempted
Discovery will be in server’s method
Recovery will be in the client
If recovery were possible at the point of discovery then there would be no
point in throwing an exception
16
17. Exception Throwing
Throwing an Exception
Two stages involve in throwing exception
1. First, an exception object is created using the new keyword
2. the exception object is thrown using the throw keyword
When an exception object is created, a diagnostic string may be passed to its
constructor.
This string is later available to the receiver of the exception via the exception
object’s getMessage and toString methods.
The string is also shown to the user if the exception is not handled and leads
to the termination of the program.
The exception type we have used here, IllegalArgumentException, is
defined in the java.lang package and is regularly used to indicate that an
inappropriate actual parameter value has been passed to a method or
constructor.
17
18. Exception Throwing
Checked vs Unchecked Exceptions
Checked exceptions are intended for cases where the client should expect that
an operation could fail (for example, if it tries to write to a disk, it should
anticipate that the disk could be full).
In such cases, the client will be forced to check whether the operation was
successful.
Unchecked exceptions are intended for cases that should never fail in normal
operation—they usually indicate a program error.
For instance, a programmer would never knowingly try to get an item from a
position in a list that does not exist, so when they do, it elicits an unchecked
exception.
18
19. Exception Throwing
The Effect of an Exception
Two Effects
1. the effect in the method where the problem is discovered and the
exception is thrown
2. the effect in the caller of the problem method
When an exception is thrown, the execution of the current method finishes
immediately; it does not continue to the end of the method body
Consider the following contrived call to getDetails:
String phone = details.getPhone();
The execution of these statements will be left incomplete
19
20. Exception Throwing
Preventing Object from Creation
An important use for exceptions is to prevent objects from being created if
they cannot be placed in a valid initial state
This will usually be the result of inappropriate parameter values being
passed to a constructor.
The process of throwing an exception from a constructor is exactly the same
as throwing one from a method
An exception thrown from a constructor has the same effect on the client as
an exception thrown from a method.
20
21. Exception Handling
Checked Exceptions – the throws clause
The first requirement of the compiler is that a method throwing a checked
exception must declare that it does so in a throws clause added to the
method’s header.
public void saveToFile(String destinationFile)
throws IOException
It is permitted to use a throws clause for unchecked exceptions, but the
compiler does not require one
21
22. Exception Handling
Checked Exceptions – the try statement
Second requirement, when using checked exceptions
Method that throws a checked exception must make provision for dealing
with the exception
Use try statement to make a try block
Syntax
try{
Protect one or more statements here.
}
catch(Exception e) {
Report and recover from the exception here.
}
22
23. Exception Handling
Checked Exceptions – the catch statement
catch block catches all exceptions of its type and subclasses of its type
If there are multiple catch blocks that match a particular exception type, only
the first matching catch block executes
Makes sense to use a catch block of a superclass when all catch blocks for that
class’s subclasses will perform same functionality
23
24. Exception Handling
Checked Exceptions – the finally Block
Consists of finally keyword followed by a block of code enclosed in curly
braces
Optional in a try statement
If present, is placed after the last catch block
Executes whether or not an exception is thrown in the corresponding try block
or any of its corresponding catch blocks
Will not execute if the application exits early from a try block via method
System.exit
Typically contains resource-release code
24
25. Sequence of Events for throw
Preceding step
try block
throw statement
unmatched catch
matching catch
unmatched catch
next step
Exception Handling
25
26. Sequence of Events for No throw
Preceding step
try block
throw statement
unmatched catch
matching catch
unmatched catch
next step
Exception Handling
26
27. Sequence of Events for finally clause
Preceding step
try block
throw statement
unmatched catch
matching catch
unmatched catch
next step
finally
Exception Handling
27
28. Exception Handling
28
Exceptional Flow of Control
Exceptions break the normal flow of control.
When an exception occurs, the statement that would normally execute next is
not executed.
What happens instead depends on:
whether the exception is caught,
where it is caught,
what statements are executed in the ‘catch block’,
and whether you have a ‘finally block’.
29. Exception Handling
29
Catching a Exception Complete Template
try { // statement that could throw an exception
}
catch (<exception type> e) {
// statements that handle the exception
}
catch (<exception type> e) { //e higher in hierarchy
// statements that handle the exception
}
finally {
// release resources
}
//other statements
At most one catch block executes
finally block always executes once, whether there’s an error or not
30. Exception Handling
30
Compile Time Exception Example
import java.io.File;
import java.io.FileReader;
public class FilenotFound_Demo {
public static void main(String args[]){
File file=new File("E://file.txt");
FileReader fr = new FileReader(file);
}
}
C:>javac FilenotFound_Demo.java FilenotFound_Demo.java:8: error:
unreported exception FileNotFoundException; must be caught or declared
to be thrown FileReader fr = new FileReader(file); ^ 1 error
31. Exception Handling
31
Run Time Exception Example
public class Unchecked_Demo {
public static void main(String args[]){
int num[]={1,2,3,4};
System.out.println(num[5]);
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at Exceptions.Unchecked_Demo.main(Unchecked_Demo.java:8)
32. Exception Handling
32
Catching a Run Time Exception
public class Exception{
public static void main(String aa[]){
try{
int a[]=new int[1];
System.out.println(a[2]);
}
catch(Exception e){
System.out.println("Exception Caught");
}
finally{
System.out.println(“Finally Block");
}
System.out.println(“After Exception”);
}
}