Powered by Blogger.
Showing posts with label programs. Show all posts
Showing posts with label programs. Show all posts

Java Program to Print Square Pattern with Stars

>> Wednesday, August 8, 2018

This is a very basic program for beginners who starts learning for loop. This is the best example to understand how the nested loops works. In our program we are going to print the below square star (* ) pattern as shown in the image.
SquarePattern_JavabynataraJ

Read more..

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

Read more..

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

Read more..

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 more..

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

Read more..

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

Read more..

Program to Convert Decimal to Octal,Hexa and Binary values

>> Saturday, October 18, 2014

Binary, Hexa and Octal are the number formats to use in different mathematical calculations. In our real life we use numbers with decimals. It may be integer value or float value both are called as decimals. Let us know the number format examples given below:
Decimal format : A representation of a real number using the base ten and decimal notation.
program to convert decimal to octa-hexa-binary_JavabynataraJ

Read more..

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