Java Programming- Basic to advanced

What Is Programming?

It’s all about writing code. Programming is a process in which we organize data and use logic to do something with those data. The data are everything a computer can store; they can range from numbers to zombie characters in a video game.

What is Algorithm?

This is classic computer science right here. Programming without knowledge of algorithms is like carpentry with just one kind of saw: you can get the job done, but it’s going to take a lot longer.

You can look at an algorithm as “discipline”. When you learn to write them, what you’re doing is solving a problem with discipline; using structure,patterns, and logical steps.

                        When you don’t know how to discipline your mind,                           you don’t know how to write algorithms.

Learn Java Programming

Now a days, Java is most demanding programming language for creating web applications and platforms. Also Java is one of the most popular because of its flexibility and portability. Java is portable language and that Java programs we can run on any of the operating system. It is time to explain how this is possible. For that you need to see and learn java programming concepts which we will explained in this website.

Count the number of co-prime pairs in an array

Program: Count the number of co-prime pairs in an array. (co-prime numbers means Any two numbers whose GCD is 1) Input: The first line contains an integer T, total number of elements. Then follow T elements. Output: Count the number of co-prime pairs in an array. Sample Input and Output: Input 1: 3 1 2 3 Output 1: 3 Here, Co-prime pairs are (1, 2), (2, 3), (1,...

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...

HOW TO GET DISTINCT ELEMENTS FROM AN ARRAY BY AVOIDING DUPLICATE ELEMENTS?

Here we explain how to find distinct elements from an array by avoiding duplicate elements. In the below program we use array of integers int num[], in this array we found distinct elements. For finding the distinct elements we use the following two ways. Program: Find distinct elements from an array public class MyDisticntElements { public static void printDistinctElements(int[] arr) { for(int i=0;i<arr.length;i++) { boolean isDistinct = false;...

PROGRAM TO ADD TWO NUMBERS WITHOUT USING PLUS (‘+’) SIGN

In our daily life we add some numbers and for this addition we use "+" sign. I have a one question, Can it be possible without using plus sign we add numbers? the answer is Yes! we can add two numbers without using the plus ("+") sign. In the below program we use two different methods for addition of two numbers. First method add() in which we add...

Java String Methods with Examples

Java string methods with examples: There are different string methods in java we will use this methods for perform various operations on the string in java.Following are some Java String Methods with Examples. Program: Get character from a string In this program we use charAt() method to get or access the single character from a specified position. class StringExample { public static void main(String[] args) { String str...

Back to Top