Core Java interview
- 05 October
Print prime numbers from 1 to 100 in java
In this program, we will print prime numbers from 1 to 100 in java. A prime number is a number which has only two divisors 1 and itself. To check if the number is prime or not, we need to see if it has any other factors other than 1 or itself. If it has, […]
- 29 May
How to print even and odd numbers using threads in java
In this post, we will see how to print even and odd numbers using threads in java. see also: How to print sequence using 3 threads in java Problem You are given two threads. You need to print odd numbers using one thread and even numbers using another thread.You need to print in natural order […]
- 31 March
FizzBuzz program in java
In this post, we will see how to program FizzBuzz in java. Fizzbuzz is a fun game played generally by school children. It is simple game in which when your turn comes, you need to say the next number. So here are rules of the game: If number is divisible by 3, then you need […]
- 10 March
Print pyramid pattern: 1 3*2 4*5*6 pattern in java
In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 11*12*13*14*15 Solution If you notice the pattern we need to print odd rows in increasing order and even rows in […]
- 30 January
Difference between early binding and late binding in java
Binding in Java refers to the process of associating a method or function body with a method or function call by the Java Compiler. In simpler words, when a function is called by the Java compiler the task of correctly locating the method for the respective function is binding. Depending on when the compiler is […]
- 21 October
Difference between equals() and == in java
In this post, we will see about the difference between equals and == in java. This is most asked java interview question for fresher or 2-year experienced java developer and it might be confusing sometimes. Let’s try to understand each quickly. Equality operator “==” Equality operator can be used to compare primitives but when you […]
- 24 May
Collections in java
In this tutorial, we will see about Collections in java. Collection framework is core part of java programming language. It is used in almost all the applications. Collections framework provides a way to store and retrieve the collection of elements. This framework has many interfaces and classes which makes programmer life easy. Let’s go through […]
- 20 May
Java 8 tutorial
In this post, we will see about Java 8 tutorial. I have written a lot of tutorials on Java 8. This is index post for all Java 8 posts. Java 8 has lots of new features which will change the way you do programming. Here is a list of features you need to know to […]
- 20 January
Java program to count number of words in sentence
In this tutorial, we will see a simple java program to count number of words in sentence. [crayon-6767cc687d6ca352855921/] Output: Enter a Sentence : Java2Blog is a technical blog. Total number of words are 5 That’s all about Java program to count number of words in sentence.