Posts

Inner class and nested Static Class in Java with Example

Inner class and nested static class in Java both are classes declared inside another class, known as top level class in Java. In Java terminology, If you declare a nested class static, it will called nested static class in Java while non static nested class are simply referred as Inner Class. Inner classes are also a popular topic in Java interviews. One of the popular question is difference between inner class and nested static class , some time also refereed as difference between static and non static nested class in Java. One of the most important question related to nested classes are Where should you use nested class in Java? This is one of the tricky Java question, If you have read Effective Java from Joshua Bloch than in one chapter he has suggested that if a class can only be useful to one particular class, it make sense to keep that inside the class itself otherwise declare it as top level class. Nested class improves Encapsulation and help in maintenance. I actually look J...

Ratih Purwasih - Hati dan Cintamu

Bb                               Eb Yang, untuk apa cincin ini kau berikan padaku                        F                                                  Cm Bb F Sedangkan hati dan cintamu kau berikan pada dia Bb                                               Eb Janganlah-jangan lagi kau kirim bunga untuk diriku     F                                         Cm               Bb Kalau hati dan cintamu kau berikan pada dia (*) Bb           ...

How to add, modify and drop column with default value, NOT NULL constraint - MySQL database Example

How to add column in existing table with default value is another popular SQL interview question asked for Junior level programming job interviews . Though syntax of SQL query to add column with default value varies little bit from database to database, it always been performed using ALTER keyword of ANSI SQL. Adding column in existing table in MySQL database is rather easy and straight forward and we will see example of SQL query for MySQL database which adds a column with default value. You can also provide constraints like NULL or NOT NULL while adding new column in table. In this SQL tutorial we are adding third column in a table called Contacts which contains name and phone of contacts. Now we want to add another column email with default value "abc@yahoo.com". We will use ALTER command in SQL to do that. By the way this is next in our SQL tutorials e.g. How to join three tables in SQL and SQL query to find duplicate records in table . If you haven't read them ye...

Mengenal Prof Miriam Budiardjo

Image
Prof Miriam Budiardjo (lahir di Kediri, Jawa Timur, 20 November 1923, meninggal di Jakarta, 8 Januari 2007 pada umur 83 tahun) beliau adalah pakar ilmu politik Indonesia dan mantan anggota Komisi Nasional Hak Asasi Manusia. Istri dari Ali Budiardjo, seorang tokoh perjuangan Indonesia, beliau ini pernah menjabat sebagai Dekan Fakultas Ilmu Sosial dan Ilmu Politik Universitas Indonesia (FISIP UI) periode 1974-1979. itu sedikit tentang biografi dari prof Miriam Budiardjo, bagi kita yang belajar ilmu politik dan ilmu hukum pastinya tidak asing dengan nama belau.

What is Type Casting in Java - Casting one Class to other class or interface Example

Type casting in Java is to cast one type, a class or interface, into another type i.e. another class or interface. Since Java is an Object oriented programming language and supports b oth Inheritance and Polymorphism , It� s easy that Super class reference variable is pointing to SubClass object but the catch here is that there is no way for Java compiler to know that a Superclass variable is pointing to SubClass object. Which means you can not call a method which is declared in the subclass. In order to do that, you first need to cast t he Object back into its original type. This is called type casting in Java . You can type cast both primitive and reference type in Java. The concept of casting will be clearer when you will see an example of type casting in next section. Read more �

How to parse or convert String to long in Java - 4 Examples

How to convert a string to long in Java is one of those frequently asked questions by a beginner who has started learning Java programming language and not aware of how to convert from one data type to another. Converting String to long is similar to converting String to Integer in Java, in-fact if you know how to convert String to Integer than you can convert String to Long by following same procedure. Though you need to remember few things while dealing with long and String first of all long is primitive type which is wrapped by Long wrapper class and String is an Object in Java backed by character array. Before Java 5 you need to take an extra step to convert Long object into long primitive but after introduction of autoboxing and unboxing in Java 5 , Java language will perform that conversion for you. This article is in continuation of our previous conversion tutorial like how to convert String to Double in Java or how to convert String to Enum in Java . In this Java tutori...

Tutorial How to fix java.io.NotSerializableException: org.apache.log4j.Logger Error in Java

Image
java.io.NotSerializableException: org.apache.log4j.Logger error says that instance of org.apache.lo4j.Logger is not Serializable. This error comes when we use log4j for logging in Java and create Logger in a Serializable class e.g. any domain class or POJO which we want to store in HttpSession or want to serialize it. As we know from 10 Java Serialization interview question that, if you have a non serializable class as member in a Serializable class, it will throw java.io.NotSerializableException Exception. Look at the below code : public class Customer implements Serializable{ private Logger logger =   Logger.getLogger(Customer.class) ...... } If instance of Customer will be stored in HttpSession or Serialized externally it will throw " java.io.NotSerializableException: org.apache.log4j.Logger" because here logger instance is neither static or transient and it doesn't implement Serializable or Externalzable interface. H...