Skip to main content

Posts

Exception, AWT and Layout Manager in JAVA

Difference b/w exceptions and assertions. Define call stack mechanism. Is it possible to create user define exception. If yes then explain how? Write a program to print the sum of array using fine-grained exception handling. Exceptions are the mechanism used by many programming languages to describe what to do when something unexpected happens. Typically something unexpected is an error of some sort, for example when a method is invoked with unacceptable arguments, or a network connection fails, or the user asks to open a non-existent file. Assertions are a way to test certain assumptions about the logic of a program. Assertions are used to test assumptions about local program logic inside a method, and usually not to test that external exceptions are met. For example , if we believe that that at particular point the value of a variable will always be positive, then an assertion can test this. Assertions can be removed entirely from the code when it runs. This make it poss

advanced Java

Java - Data Structures The data structures provided by the Java utility package are very powerful and perform a wide range of functions. These data structures consist of the following interface and classes: ·          Enumeration ·          BitSet ·          Vector ·          Stack ·          Dictionary ·          Hashtable ·          Properties All these classes are now legacy and Java-2 has introduced a new framework called Collections Framework, which is discussed in next tutorial: The Enumeration: The Enumeration interface isn't itself a data structure, but it is very important within the context of other data structures. The Enumeration interface defines a means to retrieve successive elements from a data structure. For example, Enumeration defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements. Enumeration interface                         The Enumeration interface defines