sdfsfsdf [accordions id=”25671″] sdfds [WPSM_AC id=25675]
Uncategorized
New Line BufferedWriter Java
New Line BufferedWriter Java uses newLine() method to give new line in the destination file. Example given. But before going into example and explanation, let us see what DataOutputStream will do with new line in the destination file. DataOutputStream does not have a builtin method. Infact, new line is OS dependent. \n works in System.out.print(). …
Java Font Example
Java AWT supports graphics drawing in colors and fonts. To support colors and fonts, the Java.awt package come with two classes – class Color and class Font. Java Font Example to create font objects and changing change string fonts. import java.awt.*; public class JavaFontExample extends Frame { public JavaFontExample() { setSize(450, 300); setVisible(true); } public …
Interview Questions for Freshers
OOPS Concepts What are local and global variables? A variable declared inside a method is known as “local variable” and its usage is limited within the method in which it declared only. A global variable (known as instance variable in Java) is declared outside of any method but wihtin the class. Its scope is for …
Color scheme
Collections All Methods – At a Glance Reversing elements with reverse() How many times element occurs with frequency() Replacing elements with replaceAll() Finding Min and Max values with min() and max() Sorting ArrayList with Collections sort() Sorting ArrayList with Collections sort() Comparator Searching an element with binarySearch() Copying one list to another with copy() Swapping …
Create and Start thread start() Example Java
Starting Thread start() is very easier in Java. It is the occasion to prove that Java is simple to practice. Just extend Thread to your class and create an object of your class. The object is nothing but a thread of your class. Start reading. In Java, a thread can be created in two ways. …
Java Made Simple: Create Checkbox Example
Checkbox Example tutorial is given in Question/Answer format for easy understanding. 1. What is Checkbox? Checkbox is one of the GUI components Java supports. 2. When Checkbox is preferred by the Programmer? Checkbox is used when the user has got only two options to choose in between like Yes or No, Want or Dont want. …
Java Interface Inheritance
Java Interface Inheritance – Example – Explanation – Screenshot – Simple terms for a Beginner Interfaces were introduced by the Java Designers to support multiple inheritance. Not only that, interfaces give a template methods from which new classes can be developed easily. Interface gives plan of methods required to achieve a task like a blue …
Java Scanner class
To make coding less, the Designers introduced java.util.Scanner (Scanner is not from java.io package) in Java 5. Earlier to Java Scanner class, keyboard input was taken using DataInputStream and BufferedReader, both requiring extra code of parsing the user input. Java Scanner avoids parsing. Example on Java Scanner taking Keyboard input import java.util.Scanner; public class KeyboardScanner …
Java Method Example
A method in Java, like a function in C/C++ (in fact, a function of C/C++ is called a methods in Java), embeds a few statements. A method is delimited (separated) from the remaining part of the code by a pair braces. Method increases reusability. When the method is called number of times, all the statements …
Get Super classes of a Class Java Reflection API
It is advised to read the notes on Java Reflection API before attempting the programs. Example to get super classes of a class with Java Reflection API import java.awt.Button; import java.lang.reflect.Modifier; class Test { } class Hello extends Test { } public class Demo extends Hello { public static void main(String [] args) { Demo …
Get Super classes of a Class Java Reflection API Read More »