Apr 28

First of all a short explanation about wrapper

wrapper take primitive data types  in an object.

Aditionally there is a wrapperclass for void which is not a primitive data type.

Advantages of wrapper are:

  • primitive data types can be taken in complex dta structures (containers)
  • primitive data type is capsulated through the wrapper class
  • functions are used to access the values as well as for transfer – functions

More … and especially examples will follow within the next posts

Tagged with:
Apr 21

An error can also be thrown more than once:

class Shop {

static void test () throws Error {

throw new Error ();

}

public static void main(String args[]) {

try {

test();

}catch (Error e) {

e.printStackTrace();

throw e; // error is thrown again

}

}

}

Apr 14

Although it doesn’t make sense – there is a possibility to throw and catch errors in a controlled way:

class Shop {

static void test ()  throws Error {

throw new Error ();

}

public static void main(String args[])  {

try {

test();

} catch (Error e) { e.printStackTrace(); }

}

}

errors can be threated like unchecked exceptions – the declarations in the header are as well optional as the try/catch/finally block and can be omitted. Definitions in own error-classes are also possible ie:

class x extends Error {}

preload preload preload
http://www.wikio.de Blog Top Liste - by TopBlogs.de Blogverzeichnis - Blog Verzeichnis bloggerei.de Bloggeramt.de Software
Webbhotell Top Blogs