4 Ways to Calculate Power of Number in Java

Here I have shared the 4 different ways to calculate power of number in Java. Using Loop Using Recursion Using Math.pow() Using BigInteger.pow() 4 Ways to Calculate Power of Number in Java 1. Using Loop We can calculate the power of number by repeatedly multiplying the number by itself in a loop. This method works only for positive integer power.

  Output Enter a number and its power: 3 3 27   2. Using Recursion Recursion can also be

Read more

Program for Armstrong Number in Java

Here you will get program for armstrong number in java. A number which is equal to the sum of its digits raised to the power n is called armstrong number. Here n is the total digits in the given number. Example: 9 is an armstrong number as n = 1 and 91 = 9. 153 is an armstrong number as n = 3 and 13 + 53 + 33 = 1 + 125 + 27 = 153. Program for Armstrong Number in Java

Read more

Java SOAP Web Services Tutorial

In this tutorial you will learn about java soap web services. In my previous tutorial I have given the basic overview of web services. I would recommend you to read it first. Read: Java Web Services Tutorial Java SOAP Web Services SOAP SOAP is the short form of Simple Object Access Protocol. It is a platform independent and XML based protocol. The web services developed using this protocol are called soap web services.   WSDL WSDL is the short form

Read more

Difference between include directive and include action tag in JSP

  Both include directive and include action tag are used to include some jsp page, html page or text file inside another jsp page. Still there are several differences between them that I have explained in this tutorial. Difference between include directive and include action tag in JSP   S. No. include directive include action tag 1. It includes resource at translation time. Translation is the phase of jsp life cycle in which jsp is converted into servlet. It includes

Read more

String Constant Pool in Java

What is String Constant Pool in Java? It is a special memory area in Heap that contains references of string objects. There are two ways to create string object in Java. 1. Using string literal Example: String s = “java”; A string written inside double quotes is called string literal. Whenever we create string literal the JVM checks string constant pool. If the string is already present in pool then its reference is fetched. If the string is not present

Read more

Why Java Does Not Support Multiple Inheritance?

In this tutorial you will learn why java does not support multiple inheritance. It is a very popular and frequently asked java interview question. What is Multiple Inheritance? When a class inherits two or more classes then this scenario is called as multiple inheritance. Also Read: Why Java Does Not Support Pointers? Why Java Does Not Support Multiple Inheritance? Lets consider a situation to understand this. There are three classes A, B and C. A and B class contains a method

Read more

Save and Retrieve Image from MySQL Database Using Servlet and JSP

Here you will learn how to save and retrieve image from mysql database using servlet and jsp. This method will work with Servlet 3.0 and MySQL 5.5 and higher versions. Also Read: How to Connect Java (JDBC) with MySQL or Oracle Database Save and Retrieve Image from MySQL Database Using Servlet and JSP Database Create a table in mysql database with following schema. Database Name: test Table Name: data Here I have used MEDIUMBLOB datatype to store image in database. It

Read more

Difference between String and StringBuffer in Java

Difference between String and StringBuffer or String vs StringBuffer is a very commonly asked java interview question. Both String and StringBuffer classes are used to store and manage sequence of characters but still there are some differences between them that I have explained in this tutorial. Difference between String and StringBuffer in Java Mutability String class is immutable. It means once an object is assigned a value it can’t be changed. Example:

In above case total two objects are

Read more
1 7 8 9 10 11 13