Inheritance and Overriding

Classes can extend generic classes, and provide values for type parameters or add new type parameters by in doing so. For example, all the following are legal:  class MyStringList extends ArrayList<String> { ... }  class A<X, Y, Z> { ... }  class B<M,N> extends A<N, String, Integer> { ... } The addition of generics does, however, change the rules of method overriding slightly. Note in the first example above (MyStringList) the effective signatures of the 'get' method in ArrayList and our subclass: ArrayList:  public...

Exception Handling in Generics

Type parameters may be used in the throws clause of a method declaration, but (to preserve JVM compatibility) not in a catch clause. shows an example.  Generic exception handling.  public interface MyAction <E extends Exception> {   public void doWork() throws E;  }  public class MyFileAction implements MyAction<FileNotFoundException> {  public void doWork() throws FileNotFoundException {    new File("/foo/bar.txt");   // do something here...  }  }  // client code  MyFileAction...

Type Erasure of Generics

When a generic type is instantiated, the compiler translates those types by a technique called type erasure — a process where the compiler removes all information related to type parameters and type arguments within a class or method. Type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created before generics. For instance, Box<String> is translated to type Box, which is called the raw type — a raw type is a generic class or interface name without any type...

40 million people in protest against SOPA and PIPA campaign

In protest against SOPA, Mozilla announced more than 40 million people were reached.around 30 million people in the U.S. use Firefox's default start page, which reached the lion's share of users; and the social media messages Mozilla sent out were retweeted, shared, and liked by more than 20,000 people.As a result of Mozilla's campaign, 360,000 e-mails were sent to senators and members of Congress, 1.8 million people went to mozilla.org/sopa to learn more about the antipiracy laws, and 600,000 went...

Device Queue and Print Daemon

Device Queue All the Print Requests are registered in the Print Queue and printed, for example, directly in UNIX or by using the BAAN lp6.1 script. Some options are: You can restart the print request without running the session again You can preserve the request for later use. You can display the request. You can also change a couple of things depending on the Status of the Print Request.  Printer DaemonThe Printer Daemon is a process that handles the Queue and registers the request as...

Device Management in BAAN ERP

Introduction Generating output is one of the most important tasks of an information system.  Raw data is fed into the system and processed.  The processed data must then be sent to a suitable output device such as a printer, a terminal screen, or a file to be of further use. Figure Representing Device Management: Device Types: Within BAAN Software the following Device Types can be defined: Printer (Physical Printer) Direct (also a physical printer but not handled by the print deamon) Logical...

Phone hacking: Jude Law, Lord Prescott and Sara Payne get payouts

 Law's phone was hacked repeatedly between 2003 and 2006 Jude Law and Lord Prescott are among the latest people given payouts over phone hacking by the News of the World. Actor Law received £130,000 ($200,000) and his ex-wife Sadie Frost £50,000. The ex-deputy PM got £40,000, the High Court was told. Sara Payne, mother of murdered schoolgirl Sarah, and Shaun Russell, whose wife and daughter were murdered in 1996, were given undisclosed sums. News International apologised in court but...

What do you mean by string immutability in Java?

Ques:what is meant by strings are immutable in java?Ans: immutable means that once an object of that Class has been created it can't be altered. This is useful as it means you can pass references to the object around, without worrying that someone else is going to change it's contents. Why String is immutable?If they were mutable then there would be no String pool implementation and the performance gains of the String pool become lo...

Wrong Use of Generics

When we define generics, we use Object as a data type where we are not sure about the actual type. Map<String, Object> data = new HashMap<String, Object>(); We are not doing any value add by defining the generic as Object (You must be remembering that Object class is the Super parent clas...

Subtyping of Generics

As you already know, it's possible to assign an object of one type to an object of another type provided that the types are compatible. For example, you can assign an Integer to an Object, since Object is one of Integer's supertypes: Object someObject = new Object(); Integer someInteger = new Integer(10); someObject = someInteger; // OK In object-oriented terminology, this is called an "is a" relationship. Since an Integer is a kind of Object, the assignment is allowed. But Integer is also a kind of Number, so the following code is valid as well: public...

What is Wildcard in Generics?

When no specific knowledge of the value of a type parameter is needed, it can be replaced by a wildcard. The wildcard alone, represented by a question mark, takes the value of the default bound of the corresponding formal type parameter, which is Object in following example:   void printElements(List<?> myList) { ... } A wildcard might include an upper bound, which states that the value of the type parameter must be equal to, or a descendent of the bound, as in the following:  void addAll(Collection<? extends E>) { ......

Explain Bounded type parameters of Generics

A declaration of type parameters for a class or an interface is allowed to place restrictions on the relations between the types involved. These restrictions are of the form of subtype (supertype) relations. For example public class Foo<S,T extends S> {     ... } declares two type parameters S and T for class Foo, but requires in addition that, in any instantiation, T must be a subtype of S. (It can be expected that this relation between the two types will be exploited in the code defining the class Foo, otherwise it would...

The Diamond - Generics

 In Java SE 7 and later, you can replace the type arguments required to invoke the constructor of a generic class with an empty set of type parameters (<>) as long as the compiler can determine, or infer, the type arguments from the context. This pair of angle brackets, <>, is informally called the diamond. For example, you can create an instance of Box<Integer> with the following statement: Box<Integer> integerBox = new Box<>();      Generic Methods:  You can write a single generic...

What is Generics?

Generics are a built-in language feature that will make your software more reliable .The feature of Generics in Java allows Applications to create classes and objects that can operate on any defined types. Programmers can now make use of the Generics feature for a much better code. There is no need for un-necessary casting when dealing with Objects in a Collection. Why we use generics? Generics add stability to your code by making more of your bugs detectable at compile time. Let's begin by designing a nongeneric class. public class NonGenerics...

ORA-32018: Parameter Cannot be modified in memory on another instance

ORA-32018: parameter cannot be modified in memory on another instance  Cause: Parameter adjustment can take a very long time  Action: Modify the parameter individually on each instance using the SID clause of the alter system command Problem Description In RAC database setting a memory parameter fails with ORA-32018. For example whenever we try to set streams_pool_size to a value then it fails like below. SQL> alter system set streams_pool_size=100M; alter system set streams_pool_size=100M * ERROR at line 1: ORA-32018: parameter...

Types of problem that can occur during Media Recovery

Media recovery encounters a problem while recovering a database backup. There are some problems occur during media recovery. 1) Missing ArchivedLog: In this database cannot find the archived log recorded in the control file so it stops the recovery. 2) When you attempt to open the database, error ORA-01113 Indicates that a datafile needs media recovery:  - You are performing incomplete recovery but failed to restore all needed datafile backups. - Incomplete recovery stopped before datafiles reached a consistent SCN. - You are recovering...

ORA-00001 unique constraint (string.string) violated

ORA-00001 unique constraint (string.string) violated Cause: An UPDATE or INSERT statement attempted to insert a duplicate key. Action: Either remove the unique restriction or do not insert the key.Drop the unique constraint Change the constraint to allow duplicate values Modify your SQL so that a duplicate value is not created If you are not sure which unique constraint was violated, you can run the following SQL:     select distinct table_name     from all_indexes     where index_name =...

User Management in BAAN ERP

Introduction One of the most important tasks in an information system environment is effectively managing and monitoring system usage.  Special user requirements and restrictions may have to be implemented.  BAAN provides comprehensive facilities to handle user and security management. Login Procedure Users can login and work with the BAAN software if their user accounts are defined at two different levels: UNIX BAAN With all the User Interfaces, the password file is checked for the...

Source code of Symantec stolen in 2006 Hack

2006 security breach led to the theft of source code for some of its flagship products, backtracking on earlier statements that its network had not been hacked 2006 security breach led to the theft of source code for some of its flagship products, backtrackThe security software maker, which had previously blamed the theft on a third party, acknowledged that hackers had infiltrated its own networks. The hackers obtained 2006-era source code for Norton Antivirus Corporate Edition, Norton Internet...

What do you mean by string immutability in Java?

Ques:What is meant by strings are immutable in java? Ans: Immutable means that once an object of that Class has been created it can't be altered. This is useful as it means you can pass references to the object around, without worrying that someone else is going to change it's contents. Why String is immutable? If they were mutable then there would be no String pool implementation and the performance gains of the String pool become lost. Ques: What is the difference between Spring and Spring-MVC. Ans: Spring is composed of three parts: Spring...

Application Dictionary(APDD) vs Runtime Dictionary(RTDD)

APDD are the Tools Tables of Company 000. With the Tools application, you will maintain the BAAN Software creating entries in Company 000. These changes need to be moved to the directory structure by: Compilation:  Reports, Program Scripts and Dynamic Link Libraries Generate Dump:  Forms and Menus Conversion:  User Data, Database Information, etc. Direct Available:  Means that those tables are used at runtime as well It is important to note that those items requiring a conversion...

How SubString Works in Java?

Ques:  How SubString works in Java ans:Substring is used to get chunk of text from the String...to get the substring ,we need starting index and last index.Starting index defines the starting position from where the first letter of the substring starts.and last letter is last index-1. for example String a="Hello"; System.out.println(a.subString(1,3)); output:el we can also use only starting index for example: String FullName = "Bill Gates"; String test = FullName.substring( 2 ); output:ll Gates This time, we only have 1 number between...

${BSE} directory

In the ${BSE} directory there are many subdirectories with software, settings and log information. Software: application: In the application directory runtime dumps of software components, like forms, menus, and report objects are stored.  Each Package VRC has its own separate directory.  bin: This directory contains UNIX programs used by BAAN IV.  The Bshell (Logic Server), Database drivers and many more programs are stored there.  A few examples of these programs are: ...

Difference Between Error and Exception

Ques:Difference between error and exception  Ans: Error and Exceptions both areboth inherit fromThrowable..but they are differ by the following ways... 1.Error: Any departure from the expected behavior of the system or program, which stops the working of the system is an error. Exception:Any error or problem which one can handle and continue to work normally. 2.An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. These JVM errors and you can not repair them at runtime. While exceptions are conditions...

Directory Structure

The Bshell acts as the logic server gathering information from the directory structure at the Operating System level. This information can be system settings or software components.  System directory paths and users definitions are examples of the type of informational settings that can be set.  Software components are objects, forms, menus, reports, etc.  These settings and software components are created with the use of the Tools software. The Tools software writes the information...

COMPARABLE AND COMPARATOR

Comparable - This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method. Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this interface can be used as keys in a sorted map or elements in a sorted set, without the need to specify a comparator. package java.lang; public interface...

How to choose which Java Colletion Class to use?

How to choose which Java collection class to use? The Java Collections API provides a whole host of data structures, especially since the API was expanded in Java 5 (and again slightly in Java 6) to include concurrent collections. At first, the array of choices can be a little daunting: should I use a HashMap or a LinkedHashMap? When should I use a list or a HashSet? When should I use a TreeMap rather than a HashMap? But with a bit of guidance, the choice needn't be quite so daunting. There are also a few cases where it's difficult to decide because...

LinkedHashMap And TreeMap

LinkedHashMap extends  HashMap:- Hash table and linked list implementation of the Map interface, with predictable iteration order. This implementation differs from HashMap in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map (insertion-order). Note that insertion order is not affected if a key is re-inserted into the map. import java.util.*; public class LinkedHashMapDemo {        ...

Hashtable implements Map

Hashtable implements Map:-  Hashtable based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time. import java.util.Hashtable; import java.util.Iterator; import java.util.Set; import java.util.Map; public class HashTableJava {     public static void main(String[] args) {        ...

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More