String Arrays in Java help us solve many programming problems that involve the use of a contiguous data structure such as arrays. A string array is nothing but an array containing strings as its elements. Basically, strings are objects in java and the string array is the array of immutable string objects. In order to …
Type Casting and Type Conversion in Java
Type Casting and Type Conversion in Java convert a variable of a specific type to another type. However, there is a difference between typecasting and type conversion. Type conversion always occurs automatically. The compiler performs it. As can be seen in the following example, type conversion may be successful or may not be. Examples of …
Java Code Examples
The following list presents some of the Java Code Examples. Basic Java Code Examples In order to find area of a rectangle, create a class Rectangle with data members length and breadth and member functions getDimensions() for reading input and findArea() to display the output. Write a program to demonstrate the use of method overloading …
Understanding Enterprise Java Beans
In this article on Understanding Enterprise Java Beans, I will explain the concept of Enterprise Java Beans and their role in building a Java Enterprise application. Basically, an Java Enterprise application that makes use of Java EE technology happens to be a multi-tier application. Further, the enterprise-level applications must be scalable and robust. Often these …
Java Servlet Practice Questions
The following Java Servlet Practice Questions contain the programming problems in Java Servlet Technology. Basically, servlets are Java programs. Further, servlets execute on Java-enabled web servers. For example, we can use the Apache Tomcat server. In fact, servlet technology provides us with a way to create dynamic web applications. Actually, Servlet technology consists of an …
JSP Practice Exercise
The following JSP Practice Exercise contains beginner’s lever programs on Java Server Pages (JSP). Basically, JSP is a technology that we can use to create dynamic web applications. Furthermore, JSP is built over servlet technology. So, it provides us the additional capability such as JSP Standard Tag Library (JSTL). For the purpose of creating the …
Example of Using this Keyword in Java
This article describes an Example of Using this Keyword in Java. Basically, this keyword in Java represents the reference to the current object. Whenever we need to represent the current object or any member of the current object, we can use this keyword. Moreover, we can use it to distinguish between the instance variables and …
Find Armstrong Number in Java
This article shows programs to Find Armstrong Number in Java. Basically, checking for an Armstrong is an important programming problem to learn a programming language. Also, it helps in developing programming logic. Meanwhile, you can find more information on Armstrong numbers here. In order to write a program, first, we need to develop its logic. …
Parameterized Constructor Example in Java
This article demonstrates Parameterized Constructor Example in Java. At first, we describe constructors in a class. Role of Constructor in a Class Since a class contains insance variables that each object of the class has its own copy, so it also needs a mechanism to initialize those instance variable. Indeed, a constructor provides such mechanism …
Sorting in Ascending Order in Java
This article demonstrates Sorting in Ascending Order in Java. In fact, array sorting is used in nearly every kind of computer application. It is an important algorithm that we must implement efficiently. Moreover, we can implement sorting in many ways. According, several kinds of sorting algorithms exist. For instance, we have bubble sort, insertion sort, …