Type Conversion and Casting

Type Conversion and Casting: If you have a experience in a programming language, then you know this thing that it is common to assign a value of one type of variable to another type variable. Java performs type conversion automatically when the two types are compatible. For example, it is always possible to assign a int to a long. But not all types are compatible, therefor all types...

Data Types In Java

In a Java there are eight different primitive types of data: byte, short, int, long, char, float, double, and boolean. This types are also referred to as a simple data types and these types are grouped into four different types: Integers: In this group byte, short, int and long are included, which are for whole-valued signed numbers.Floating-point : In this group includes float and double, which is represents...

Loops and Loop Control Statements in Java

Loops and Loop Control Statements- There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various Loop and Loop control statements that allow for more complicated execution paths. A loop statement allows us to execute...

Loop Control Statements

Loop Control Statements: Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Java supports the following control statements. Break StatementContinue Statement Break Statement: The break statement in Java programming language has the followingtwo usages − When the break statement is encountered inside a loop, the loop is immediately terminated and the program...

For Loop

A loops statement allows us to execute a statement or group of statementsmultiple times and following is the general form of a loop statement in mostof the programming languages . To gain a bit more control over the execution of a loop, we have another option. The for loop requires three different statements to operate. The first statement is called an initialization, the second is a condition, and...

While Loop

If we want to run a specific statement more than once in a loop, we need another method. To do this, java comes with another couple of keywords, while and for. The while statement is somewhat easier to use. It needs only one bool argument to determine if it should continue to execute. This statement is somewhat like the if statement, only that it returns to the top...

Operators in Java

Java defines several operators. To perform the different types of operations on variables and their values this operators are use. Logic allows you to control what part of a function is evaluated based on changesto variables. Using logic, you'll be able to change which statements in your codewill run. Simply put, everything you write must cover each situation you planto cover. Logic is controlled through a few simple...

Variables

Variables are used to store the information to be referenced and manipulated in a computer program. Variables are also provide a way of labeling data with a descriptive name, so that our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. After that...

What are Functions?

Functions, sometimes called methods, contain statements which can process data. The statements can or cannot process data.Other statements are also can access the Methods. This action is called as calling a function or making a function call. Functions may look different in different programming languages, but the way they work is mostly the same. The usual pattern is taking in data and using logic to manipulate that data....

Binary search

Binary search is one of the fundamental algorithms in computer science. In order to explore it, we’ll first build up a theoretical backbone, then use that to implement the algorithm properly and avoid those nasty off-by-one errors everyone’s been talking about. Finding a value in a sorted sequence In its simplest form, binary search isused to quickly find a value in a sorted sequence (consider a sequence anordinary...

Back to Top