Powered by Blogger.

Can I write a Java program without main method ?

>> Thursday, August 13, 2015

Yes, We can write a java program without main method by using static block, only in java version 6. But not possible in later versions like java 7 or 8.
Before going to discuss "How to write a java program without main method", let's get an idea about the programs, which are running without main method.
Java Program without main method_JavabynataraJ

Default value of primitive data types in Java

>> Saturday, August 8, 2015

In Real life to store any type of element/material, it should have suitable containers. Lets take water bottle can hold little water, like wise egg tray can hold eggs e.t.c. So to hold any object, there should have their suitable containers. In the same way, any form of the data can be stored by using the primitive data types based on their properties or attributes of the objects.
Default values of primitive data types_javabynataraj

Program to find max repeated or duplicate words from a text file

>> Thursday, July 9, 2015

In this tutorial, you will learn How to Find Maximum Occurrence of Words or repeated words from given Text File.
In the earlier post we have gone through How to read a file using BufferedReader and Scanner.This would give you a basic idea to read a file through the Streams. And the related post to this current program best way to find repeated characters from a String also helpful to understand the maximum repeated words from the given text file. Here i am using BufferedReader and FileInputStream to read a file, if the file does not exists this throws an exception FileNotFoundException.
Program to find max repeated words from a text file_javabynataraj

Read a file using BufferedReader and Scanner in Java

>> Thursday, July 2, 2015

Being a java developer, will get a chance to work with files using java.util and java.io packages. So mostly we use BufferedReader and Scanner Classes to read different files. These classes will contain respective methods to read files. Here, we will go through the classes and their's differences with a simple java program.
Read a file using BufferedjReader and Scanner_JavabynataraJ

Best practice to find Duplicate Character from a String in java

>> Sunday, June 28, 2015

This program could be the best way to find the number of duplicate characters from the given String. Here we are using Map and Set from java.util.Collections package. In the below program we are using Set to collect different characters from the given String. One boolean variable and one method named as findDuplicateChar(String myString) to find the duplicates. Also some known methods like toCharArray() to convert String to character array and for-each loop to iterate Set and Array. Better you can go through the given program to find duplicate characters from the given String.
Find duplicate characters program_JavabynataraJ

What are Generics in Java

>> Saturday, March 28, 2015

In common term Generic means a common type of things or relating to a class or group of things not specific.

In Java Generics are introduced in 2004 within Java 5.0 features along with Enum, autoboxing and varargs , to provide compile time type-safety.Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods or, with a single class declaration, a set of related types, respectively.
What is type-safety?
It is just a check by compiler that correct Type(datatype) is used in correct place and there should not be any ClassCastException.

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.