Posts

Showing posts from December, 2012

Top 10 Oracle Interview Question and Answer - Database and SQL

These are some interview question and answer asked during my recent interview. Oracle interview questions are very important during any programming job interview . Interviewer always want to check how comfortable we are with any database either we go for Java developer position or C, C++ programmer position .So here I have discussed some basic question related with oracle database. Apart from these questions which is very specific to Oracle database you may find some general questions related to database fundamentals and SQL e.g. Difference between correlated and noncorrelated subquery in database or truncate vs delete in SQL etc. Some of the most important topics in Oracle Interview questions are SQL, date, inbuilt function, stored procedure and less used features like cursor, trigger and views. These questions also gives an idea about formats of questions asked during Oracle Interview. Read more �

Lirik dan Chord Sherina - Pergilah Kau

 E                                   A Tak mau lagi aku percaya        C#m           B               A Pada semua kasih sayangmu  E                                   A Tak mau lagi aku tersentuh         C#m             B         A Pada semua pengakuanmu (*)            F#                               E Kamu takkan mengerti rasa sakit ini               A                 F#           B Kebohongan dari mulut manismu REFF:       ...

How to compare Arrays in Java � Equals vs deepEquals Example

java.util.Arrays class provides equals() and deepEquals() method to compare two Arrays in Java. Both of these are overloaded method to compare primitive arrays e.g. int, long, float, double and Object arrays e.g. Arrays.equals(Object[] , Object[]). Arrays.equals() returns true if both Arrays which it is comparing are null If both arrays pointing to same Array Object or they must be of the same length and contains the same element in each index. In all other cases, it returns false. Arrays.equals() calls equals() method of each Object while comparing Object arrays. One of the tricky question in Java related to Array comparison is Difference between Arrays.equals() and Arrays.deepEquals() method. Since both equals and deepEquals is used for array comparison, what is the difference between them becomes important. The short answer of this questions is that, Array's equals() method does not perform deep comparison and fails logical comparison in case of nested Array, on o...

How to append text into File in Java � FileWriter Example

Some times we need to append text into File in Java instead of creating new File. Thankfully Java File API is very rich and it provides several ways to append text into File in Java. Previously we have seen how to create file and directory in Java and how to read and write to text file in Java and in this Java IO tutorial we will see how to append text into file in Java. We are going to use standard FileWriter and BufferedWriter approach to append text to File. One of the key point to remember while using FileWriter in Java is to initialize FileWriter to append text i.e. writing bytes at the end of File rather than writing on beginning of the File. In next section we will see complete Java program to append text into File in Java . By the way you can also use FileOutputStream instead of FileWriter if you would like to write bytes, instead of text. Similar to FileWriter , FileOutputStream constructor also takes a boolean append argument to open connection to append bytes into...

Difference between equals method and "==" operator in Java - Interview Question

Both equals() and "==" operator in Java is used to compare objects to check equality but the main difference between equals method and the == operator is that former is a method and later is an operator. Since Java doesn�t support operator overloading , == behaves identical for every object but equals() is method, which can be overridden in Java and logic to compare objects can be changed based upon business rules. Another notable difference between == and equals method is that former is used to compare both primitive and objects while later is only used for objects comparison. At the same time, beginners struggle to find when to use equality operator (==) and when to us e equals method f or comparing Java objects. In this tutorial, we will see how equals() method and == operator works in Java and what is the difference between "==" and equals method in Java and finally when to use "==" and equals() to compare objects . Read more �

Add Translation Tool to Your Blog or Website in Several Languages

Image
This tool needs all bloggers and those interested in promoting his blog for foreigners, the tool shape beautiful and wonderful includes 7 languages ??is essential in the world. Its code <style>  .google_translate img { filter:alpha(opacity=100); -moz-opacity: 1.0; opacity: 1.0; border:0; } .google_translate:hover img { filter:alpha(opacity=30); -moz-opacity: 0.30; opacity: 0.30; border:0; } .google_translatextra:hover img { filter:alpha(opacity=0.30); -moz-opacity: 0.30; opacity: 0.30; border:0; } </style>  <div>  <a class="google_translate" href="#" target="_blank" rel="nofollow" title="English" onclick="window.open('http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&langpair=id%7Cen&hl=en'); return false;"><img alt="English" border="0" align="absbottom" title="English" height="32" src="https:/...

Kangen Band � Yolanda

Image
INTRO: D  F#  Em  A    D  F#m  Em  A           D Kemarin kau datang menemui aku         G Saat aku ragu saat aku layu       A                                                   D   A Canda tawamu tenangkan aku, Yolanda       D Ku bawa cinta sebesar dunia           G Agar engkau tahu besarnya cintaku         A                                                         D Apa kau tak m�rasa kau tak meraba, Yolanda INTRO: D  F#  Em  A    D  F#m  Em  A         D Aku menunggumu di tempat biasa     ...

How to add, subtract days, months, years, hours from Date and Time in Java

Adding days, hours, month or years to dates is a common task in Java. java.util.Calendar can be used to perform Date and Time arithmetic in Java. Calendar class not only provides date manipulation but it also support time manipulation i.e. you can add, subtract hours, minutes and seconds from current time. Calendar class automatically handles date transition or month transition for example if you ask date after 30 days it will return you date based on whether current month is 30 or 31 days long. Same is true in case of adding and subtracting years, Calendar takes care whether current or following year is a leap year or not. For example 2012 is a leap year and it has February with 29 days, if you ask Calendar day before 365 it will return 24th July (assuming current date 23 rd July) which shows it take care of leap year. By the way there are couple of more date and time related articles e.g. How to find current date and time in Java and How to convert Date to String in Java . If you...

Internet Download Manager (IDM) Lifetime Activation (Update)

Image
(Update): Internet Download Manager (IDM) Patch (scroll down for detail) In this short post I am going to show you how to register your trial (free) version of IDM for life time and most importantly for free. You first need to install any version of Internet Download Manager (IDM) on your PC and then follow the steps below: First of all open the C:\ Drive of you computer and then open the WINDOWS folder Once you open the WINDOWS folder now search the system 32 folder in it. In system 32 folder find the Drivers folder and open it. In Drivers folders you will see a folder titled �etc� open it and find the hosts file in it Now open the hosts file in Notepad Copy and paste the following code in hosts file 127.0.0.1 tonec.com 127.0.0.1 www.tonec.com 127.0.0.1 registeridm.com 127.0.0.1 www.registeridm.com 127.0.0.1 secure.registeridm.com 127.0.0.1 internetdownloadmanager.com 127.0.0.1 www.internetdownloadmanager.com 127.0.0.1 secure.internetdownloadmanager.com 127.0.0.1 mirror.inter...

Difference between Primary key vs Foreign key in table � SQL database tutorial

The main difference between Primary key and Foreign key in a table is that it�s the same column which behaves as primary key in the parent table and as a foreign key in a child table. For example in Customer and Order relationship, customer_id is the primary key in Customer table but a foreign key in Order table. By the way, what is a foreign key in a table and difference between Primary and Foreign key are some of the popular SQL interview questions, much like truncate vs delete in SQL or difference between correlated and noncorrelated subquery ? We have been learning key SQL concepts along with these frequently asked SQL questions and in this SQL tutorial, we will discuss what is a foreign key in SQL and purpose of the foreign key in any table. By the way, this is the third article related to a primary key in SQL, other being difference between primary and unique key and How to find second highest salary in SQL . If you are preparing for any technical job interview where you e...

How to fix java.lang.classcastexception cannot be cast to in Java - cause and solution

As name suggests ClassCastException in Java comes when we try to type cast an object and object is not of the type we are trying to cast into. In fact ClassCastException in Java is one of most common exception in Java along with java.lang.OutOfMemoryError and ClassNotFoundException in Java before Generics was introduced in Java 5 to avoid frequent instances of java.lang.classcastexception cannot be cast to while working with Collection classes like ArrayList and HashMap , which were not type-safe before Java 5. Though we can minimize and avoid java.lang.ClassCastException in Java by using Generics and writing type-safe parameterized classes and method , its good to know real cause of ClassCastException and How to solve it. In this Java tutorial we will see Why java.lang.ClassCastException comes and how to resolve ClassCastException in Java. We will also see how to minimize or avoid ClassCastException in Java by using Generics , as prevention is always better than cure. Read mor...

Difference between Class and Object in Java and OOPS with Example

Class and Object are two most important concept of Object oriented programming language (OOPS) e.g. Java. Main difference between a Class and an Object in Java i s that class is a blueprint to create different objects of same type . This may looks simple to many of you but if you are beginner or just heard term Object Oriented Programming language it might not be that simple. I have met many students, beginners and programmers who don�t know difference between class and object and often used them interchangeably. Also Java API having classes like java.lang.Object and java.lang.Class also adds more confusion in beginners mind. Both of them are totally different things, class and object in OOPS are concepts and applicable to all Object oriented programming language e.g. C++ or Scala. On the other hand java.lang.Class and java.lang.Object are part of Java API. Along with other OOPS concepts like Abstraction , Encapsulation , Inheritance and Polymorphism , this is also one of the ...

WONDERFUL RUNNING LED WITH ATMEGA8535

Image
Sumber:sukasukapaktri.blogspot.co.id/2012/12/wonderful-running-led-with-atmega8535.html Projek Wonderful Running Led With Atmega8535. Awalnya dia tertarik untuk belajar mikrokontroler khususnya belajar pemrograman BASCOM AVR. Wonderful Running LED Mengapa menggunakan chip ATMEGA8535 itu karena selain banyak di pasaran, IC ini juga memiliki fitur yang cukup kompleks sehingga akan mudah diaplikasikan ke dalam bentuk pengontrolan yang lain. Untuk lebih jelasnya mengenai ATMEGA8535 bisa download datasheetnya di sini . Sebagai langkah awal pembelajaran, saya aplikasikan mikrokontroler ATMEGA8535 sebagai pengendali running led yang diprogram dengan software BASCOM AVR. Pemrograman dengan BASCOM AVR LED akan secara bergantian hidup dan mati sesuai dengan instruksi program yang tersimpan dalam chip mikrokontroler. Dengan bahasa pemrograman basic kita menggunakan istilah pengondisian DO - IF - THEN - END - IF - LOOP. Berikut contoh programnya: $regfile = "m8535dat" $crystal = 110592...

How to attach source in eclipse for Jars, debugging and code look-up � JDK Example

Attaching source of any Jar in Eclipse e.g. JDK or open source libraries like Spring framework is a good idea because it help during debugging and code development. As a Java programmer at least you should attach the source of JDK in Eclipse IDE to find out more about JDK classes. Though Eclipse IDE is pretty good on code assist, sometimes You want to know what's going inside a library or a JDK method, rather than just reading the documentation. Interview questions like How HashMap works in Java or How substring cause memory leak can only be answered if you are familiar with the source code of these classes. Once you attach source code of Java or Spring in Eclipse IDE , You can check code with just a single click. Some one may argue for Java decompiler like JAD which can create source from the .class file which is also a smart way to look code for open source library, but decompiled source file is not same as the original source file, as you lost comment and readability. As per...

How to find middle element of LinkedList in Java in one pass

How do you find middle element of LinkedList in one pass is a programming question often asked Java and non-Java programmers in telephonic Interview. This question is similar to checking palindrome or calculating the factorial , where Interviewer sometimes also ask to write code. In order to answer this question candidate must be familiar with LinkedList data structure i.e. In the case of singly LinkedList, each node of Linked List contains data and pointer, which is the address of next Linked List and the last element of Singly Linked List points towards the null. Since in order to find middle element of Linked List you need to find the length of LinkedList, which is counting elements till end i.e. until you find the last element of Linked List. What makes this data structure Interview question interesting is that you need to find middle element of LinkedList in one pass and you don�t know the length of LinkedList. This is where candidates logical ability puts into the test, whet...

Recursion in Java with example � Programming Techniques Tutorial

Recursion is one of the tough programming technique to master. Many programmers working on both Java and other programming languages like C or C++ struggles to think recursively and figure out the recursive pattern in the problem statement, which makes it is one of the favorite topics of any programming interview . If you are new in Java or just started learning Java programming language and you are looking for some exercise to learn the concept of recursion than this tutorial is for you. In this programming tutorial, we will see a couple of example of recursion in Java programs and some programming exercise which will help you to write recursive code in Java e.g. calculating Factorial , reversing String and printing Fibonacci series using recursion technique. For those who are not familiar with recursion programming technique here is the short introduction: "Recursion is a programming technique on which a method call itself to calculate result". It's not as simple as i...

How to create thread safe Singleton in Java - Java Singleton Example

Thread safe Singleton means a Singleton class which returns exactly same instance even if exposed to multiple threads. Singleton in Java has been a classical design pattern like Factory method pattern or Decorator design pattern and has been used a lot even inside JDK like java.lang.Runtime is an example of Singleton class. Singleton pattern ensures that exactly one instance of class will remain in Java program at any time. In our last post 10 Interview questions on Singleton in Java we have discussed many different questions asked on Singleton pattern, One of them was writing Thread safe singleton in Java. Prior to Java 5 double checked locking mechanism is used to create thread-safe singleton in Java which breaks if one Thread doesn't see instance created by other thread at same time and eventually you will end up with more than one instance of Singleton class. From Java 5 onwards volatile variable guarantee can be used to write thread safe singleton by using double checked...

ST 12 � Cari Pacar Lagi

Image
Dok: kapanlagi.com INTRO: G       G Cintaku cintaku padamu                          Em Tak besar seperti dulu                      Am Kamu kok begitu menilai cintaku                         D Begitu rendah di matamu       G Sayangku sayangku padamu                         Em Tak indah seperti dulu                  Am Maumu begini maumu begitu                                  D Tak pernah engkau hargai aku (*)              C Oo ooh I am sorry       D                           ...

Oracle 10g Pagination Query - SQL Example for Java Programmer

Many time we need SQL query which return data page by page i.e. 30 or 40 records at a time, which can be specified as page size. In fact Database pagination is common requirement of Java web developers, especially dealing with largest data sets. In this article we will see how to query Oracle 10g database for pagination or how to retrieve data using paging from Oracle. Many Java programmer also use display tag for paging in JSP which supports both internal and external paging. In case of internal paging all data is loaded in to memory in one shot and display tag handles pagination based upon page size but it only suitable for small data where you can afford those many objects in memory. If you have hundreds of row to display than its best to use external pagination by asking database to do pagination. In pagination, ordering is another important aspect which can not be missed. It�s virtually impossible to sort large collection in Java using Comparator or Comparable bec ause of limite...

How to convert milliseconds to Date in Java - tutorial example

Do you want to convert milliseconds to Date in Java ? Actually java.util.Date is internally specified in milliseconds from epoch. So any date is number of millisecond passed since January 1, 1970, 00:00:00 GMT and Date provides constructor which can be used to create Date from milliseconds . Knowing the fact that Date is internally maintained in milliseconds allows you to store date in form of millisecond in Server or in your Class because that can be effectively expressed with a long value . In fact many experienced Java programmer store Date as long value while writing Immutable class which requires Date, one of the reason for that is Date being mutable and long value of Date can be very handy. By the ways this is next in Date related article, we have already discussed How to convert String to Date and How to get current month, year and day of week from Date in Java . If you haven�t read them already, you may find them useful. In this Java tutorial we will see example of converti...

3 Example to print array values in Java - toString and deepToString from Arrays

Printing array values in Java or values of array element in Java would have been much easier if arrays are allowed to directly prints its values whenever used inside System.out.println() or format and printf method , Similar to various classes in Java do this by overriding toString() method . Despite being an object, array in Java doesn't print any meaningful representation of its content when passed to System.out.println() or any other print methods. If you are using array in method argument or any other prominent place in code and actually interested in values of array then you don't have much choice than for loop until Java 1.4. Things has been changed since Java 5 because it introduced two extremely convenient methods for printing values of both primitive and object arrays in Java . Arrays.toString(array) and Arrays.deepToString(twoDimensionArray) can print values of any array. Main difference between Arrays.toString() and Arrays.deepToString is that deepToString i...

How to check if a number is a palindrome or not in Java - Example

How to check if a number is a palindrome or not is a variant of popular String interview question how to check if a String is a palindrome or not. A number is said to be a palindrome if number itself is equal to reverse of number e.g. 313 is a palindrome because reverse of this number is also 313. On the other hand 123 is not a palindrome because reverse of 123 is 321 which is not equal to 123, i.e. original number. In order to check if a number is a palindrome or not we can reuse the logic of How to reverse number in Java . Since in most of interview, you are supposed to solve this question without taking help from API i.e. only using basic programming construct e.g. loop, conditional statement, variables, operators and logic. I have also seen programmer solving this question by first converting integer to String and than reversing String using reverse() method of StringBuffer and than converting String back to Integer, which is not a correct way because you are using Java API. So...