- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2617 Articles for Java
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
312 Views
An array is a linear data structure that is used to store a group of elements with similar datatypes. It stores data in a sequential manner. Once we create an array we can't change its size i.e. it can store a fixed number of elements. The array comes with a vast application and use case. Also, we can perform numerous operations on arrays. This article will help you to understand the basics of arrays and also, we will make java programs to perform right and left rotation operations on arrays. Java Program for Array Rotation First, let's understand the term ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
Following is the Java code to print Number srries without using any loop −Example Live Demopublic class Demo{ public static void main(String[] args){ int my_num = 0; System.out.println("The numbers without using loop have been printed below"); print_without_loop(my_num); } public static void print_without_loop(int my_num){ if(my_num
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
138 Views
Following is the Java program for largest K digit number divisible by X −Example Live Demoimport java.io.*; import java.lang.*; public class Demo{ public static int largest_k(int val_1, int val_2){ int i = 10; int MAX = (int)Math.pow(i, val_2) - 1; return (MAX - (MAX % val_1)); } public static void main(String[] args){ int val_1 = 25; int val_2 = 2; System.out.println("The largest 2 digit number divisible by 25 is "); System.out.println((int)largest_k(val_1, val_2)); } }OutputThe largest 2 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
Following is the Java program for longest increasing subsequence −Example Live Demopublic class Demo{ static int incre_subseq(int my_arr[], int arr_len){ int seq_arr[] = new int[arr_len]; int i, j, max = 0; for (i = 0; i < arr_len; i++) seq_arr[i] = 1; for (i = 1; i < arr_len; i++) for (j = 0; j < i; j++) if (my_arr[i] > my_arr[j] && seq_arr[i] < seq_arr[j] + 1) seq_arr[i] = seq_arr[j] + 1; ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
Following is the Java program to print Triangle pattern −Example Live Demoimport java.util.*; public class Demo{ public static void main(String[] args){ Scanner my_scan = new Scanner(System.in); System.out.println("Enter the number of rows which needs to be printed"); int my_row = my_scan.nextInt(); for (int i = 1; i = i; j--){ System.out.print(" "); } for (int j = 1; j
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
898 Views
Following is the Java program to print integer between Strings −Example Live Demopublic class Demo{ public static void main(String[] args){ System.out.println("The equals symbol is present between two integer values "); System.out.println(45+5 + "=" +(56+11)); System.out.println(45+5 + " equals symbol " +(56+11)); } }OutputThe equals symbol is present between two integer values 50=67 50 equals symbol 67A class named Demo contains the main function that prints integer values between two strings.
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
973 Views
Following is the code to rename multiple files using Java −Exampleimport java.io.File; import java.io.IOException; public class Demo{ public static void main(String[] argv) throws IOException{ String path_to_folder = "path\to\folder\where\multiple\files\are\present"; File my_folder = new File(path_to_folder); File[] array_file = my_folder.listFiles(); for (int i = 0; i < array_file.length; i++){ if (array_file[i].isFile()){ File my_file = new File(path_to_folder + "\" + array_file[i].getName()); String long_file_name = array_file[i].getName(); String[] my_token = long_file_name.split("\s"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
Following is the code to clear screen using Java −Example Live Demopublic class Demo{ public static void main(String[] args){ System.out.print("\033[H\033[2J"); System.out.flush(); } }OutputThe screen would be clearedA class named Demo contains the main function. Here, the ANSI escape code is written, that clears the screen. The flush function resets the cursor to the top of the window screen.
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
Following is the Java program to check if a given number is Fibonacci −Example Live Demopublic class Demo{ static boolean perfect_square_check(int val){ int s = (int) Math.sqrt(val); return (s*s == val); } static boolean fibonacci_num_check(int n){ return perfect_square_check(5*n*n + 4) || perfect_square_check(5*n*n - 4); } public static void main(String[] args){ for (int i = 6; i