Convert String to Byte Array or Byte Array to String in Java

Sometimes we need to convert Strings into Bytes because of several reasons like, to save content to the file, sending data over a network or it can be any other reason. So in this tutorial we’ll see how we can convert string to byte array or byte array to string in Java. Convert String to Byte Array in Java Method 1: Using String.getBytes()

Output: Platform’s encoding = [[email protected] Contents of byte Array = [84, 104, 101, 32, 67, 114,

Read more

6 Best Lightweight Java IDEs

When it comes to write code in any language, all of us choose an IDE to write the code because of the syntax highlighting, auto-complete, editing and running in the same environment (without using any extra command prompt to run the code), in-built debugger, reduced setup time etc. If we want to write code in Java, the names of IDEs that comes into our minds are – NetBeans, Eclipse, IntelliJ IDEA. Which are really good IDEs to work in Java.

Read more

Java Delay – 4 Ways to Add Delay in Java

Let’s discuss about scenario when we want to introduce a delay in execution of a subsequent program. Before we move on further to understand the working of delay in Java, let’s understand some practical scenario in which we would need a delay in execution. As soon as the application is loaded and the user logged in, we want to fetch the current location of the user. We are aware that calling certain API like Google Maps API would take at

Read more

Java Reference Variable

We often are stuck at discussion about Objects and their references, it is known fact that unlike C or C++, java doesn’t allows variable access using pointers, well why it does not allows is itself a whole topic which you can read here. Today we will discuss about what all types can be given to java variables or objects. Before moving on to that concept let’s have a look at what do we mean by Reference Variable? Java Reference Variable

Read more

Why is Java So Popular?

In the world of updated and aware world, the world has seen a transition from the computer curve to Mobile Phone or smartphone as it is frequently referred, but what has remain constant in this evolving world is Java. Java was designed keeping syntax similar to C/C++, to make it look familiar to application developers. This forms one of the most important reasons of popularity of Java. But not limiting to this, let’s have a look at the underlying reasons

Read more

Java Tower of Hanoi Program

Tower of Hanoi is a mathematical puzzle game which contains three rods and N number of disks each incrementally different diameters. Initial condition: Initially all disks placed on one rod one above the other in stack manner (largest one is at the bottom and this follows…) Goal: Move all disks from this rod (say rod1) to rod2 by taking help of rod3. (Note: For understanding purpose rod numbers are given. You can give rod numbers in any manner) Rules to

Read more

Java Rock Paper Scissors Game

The rock paper scissors is a game where through hand formations; the decision of the winner is made. The game works on the following principles: The rock defeats scissors. The scissors defeat the paper. The paper defeats the rocks. If the formation is same from both the side, it is considered a draw. whoever wins 5 times is the winner. This game is made in java which encompasses a competition between the user and his computer system. Java Rock Paper

Read more

CodeGym: An Effective Way to Learn Java

So you think of learning Java. Good choice! This language is 20 years old but still progressive. The freshest (Java 11) release was in September 2018, and the next one will be in March 2019. Java is platform independent and you can do almost anything with it. Java is object oriented language but you can use different concepts, such as functional programming if you want to. It has very reach API. Java is beginner’s friendly and has the best community

Read more
1 2 3 4 5 19