Constructors are the important part of the Java code, so I tried to list out the 10 points which we must know about constructors while writing the code, for interview or for an exam. 1. First of all as we all know constructor name must always match the name of the class. 2. The default […]Continue Reading →
Java Heap Space ( or Java Object Space): Its a part of memory from the memory of operating system which java virtual machine or JVM use for the Java operations. Java heap space is normally located at the bottom of the memory space and move upwords. Whenever object gets created using new operator some space […]Continue Reading →
Many times we need to align the JTable header text. Doing this is a simple , you just need to get getDefaultRenderer from the table header. From this renderer you can get the JLabel component on which you can do the alignment as follows : TableCellRenderer rendererFromHeader = table().getTableHeader().getDefaultRenderer(); JLabel headerLabel = (JLabel)rendererFromHeader; label.setHorizontalAlignment(JLabel.LEFT); // […]Continue Reading →
Here are some conversions which converts ASCII, integer, float, double and long values to String. Conversion from ASCII code to String: We can convert ASCII code into String by creating Character Wrapper class and calling its toString() method. int i = 62; String asciiChar = new Character((char)i).toString(); System.out.println(“Ascii value of “+i+” is : “+asciiChar); Output […]Continue Reading →
Subscribe to Blog via Email
You may want to read it!
- What is the difference between AWT and Swing in java
- How to set size of PDF file using iText?
- Netbeans auto complete shortcuts you must know
- How to print message , stacktrace of Exception in java?
- How to add or remove an item in a JComboBox component?
- Simple JTable example using AbstractTableModel
- How to convert exponential format to Decimal number format in Java?
- What are port groups in VMware ESX?
- Deadlock, starvation and livelock in context of Java
- How to reverse string in java without using reverse method