WHY JAVA DOES NOT HAVE POINTERS ................................................................................................................. Well, it's debatable whether Java does or doesn't support pointers.Some would say that everything (well, every reference type) in Java is a pointer -- hence, the ever-familiar NullPointerException. But certainly, these reference types do not give one the sort of direct interaction with memory that we're familiar with from pointers in. Instead, all objects are handled by references, not to be confused with pointers or C++ references. The difference is that Java references do not refer directly to the memory location , but rather contain the pointer to the actual memory location, which the programmer cannot get direct access to. It is also true that pointers are dangerous and lead to memory leaks, memory corruption, invalid memory access, e.g. from uninitialized and improperly initialized variables, indexing out of bounds, a...
Popular posts from this blog
Arrays.sort() and Collections.sort() NullPointerException
While sorting an array by using Arrays.sort() or using Collections.sort() for sorting a list you can encounter a NPE (NullPointerException) . You might be thinking what went wrong ? So one of element in the array which have been passed for sorting contains the null element. Similar with the list case also .So check for a null entry in your array or list before passing to these methods as parameter. Example 1 : String[] strarr={"abc", "def" , null}; Arrays.sort(strarr); Output 1: -------- Exception in thread "main" java.lang.NullPointerException at java.lang.String.compareTo(String.java:1167) at java.lang.String.compareTo(String.java:92) at java.util.Arrays.mergeSort(Arrays.java:1144) at java.util.Arrays.sort(Arrays.java:1079) at Test.main(Test.java:7) Example 2: List strlist=new ArrayList (); strlist.add("abc"); strlist.add("def"); strlist.add(null); Collections.sort(strlist); Output 2: ---------- ...
Firefox search bar plugin
Hi Guys, We can do a little fun with Firefox search bar .We can create our own search engine there. Here i am creating a simple example of how you can create your own plugin. Go to the installed directory of Firefox and locate the folder "searchplugins" .Open this folder ,here you will see all the search engines xml listed there. You can copy paste the below code and restart Firefox to see your search engine in the drop down of search bar list. <SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/"> <ShortName>MySearch</ShortName> <Description>Demo search by google.. < /Description> <InputEncoding>UTF-8 < /InputEncoding> <Url type="text/html" method="GET" template="https://www.google.com/search"> <Param name="q" value="{searchTerms}"/> </Url> <SearchForm > https://www.google.com/ < /SearchForm> </SearchPlugin> an...
Comments
Post a Comment