Java Articles - Page 78 of 745

Java Program to Save a String to a File

Rudradev Das
Updated on 24-Jul-2024 21:54:31

3K+ Views

String, the series of characters, used in Java programming enable to save memory consumption and boost the performance. We can save a string to a file using Java program can be initiated in multiple ways and has been introduced in Java version 11. Four parameters can be used to save a string to a file using Java. They are the file path, character sequence, charset, and options. File path and character sequence, these two are the most important and mandatory for this approach to write into a file. This technique encodes the characters as the content, and it returns the ... Read More

Java Program to Rotate an Image

Rudradev Das
Updated on 31-Mar-2023 14:57:24

3K+ Views

A image file can rotated clockwise or anticlockwise direction. To rotate an image it is needed to download a random image file and save it in any folder on your system. Further, a .pdf file is required to create and rotate some degrees after opening the downloaded image in that particular .pdf file. For 90 degree rotations, anchor point of a new image help us to perform the rotation operation using the translate transformation in Java. The anchor point is the center for any particular image. Algorithm to Rotate an Image by Using Java The "AffineTransformOp" class is ... Read More

Java Program To Reverse A Number And Find the Sum of its Digits Using Do-While Loop

Rudradev Das
Updated on 31-Mar-2023 14:53:26

3K+ Views

What Is A Do-While Loop? Do-while loop is a Java environment used to iterate a portion of a code in a repeat manner. The process will run in a continuous way until the specified condition becomes satisfied as a true condition. It is always recommended for a do-while loop to execute at least one when there is no fixed number of iteration mentioned. In the Java environment, the do-while loop is known as an exit control loop. At the end of a loop structure, the do-while checks the whole condition to make the condition satisfied. For this the do while ... Read More

Java Program To Reverse A Number And Check If It Is A Palindrome Number

Rudradev Das
Updated on 13-Dec-2024 21:52:25

4K+ Views

What is a Palindrome Number? If a number is given (two, three or four-digit number) and reversing each individual number with the positions from front to back and then vice versa , and then if the number output is the same after reversing all the elements then it is said to be a palindrome number. Just like we will check whether the string or array is palindrome number. String - A string is a storing capsule or a storing method in which we can store a sequence of characters in a Java program. Array - An array is a collection ... Read More

Java Program to Reverse a List

Rudradev Das
Updated on 14-Jun-2024 15:35:05

20K+ Views

What is a Reverse List? Reverse a list is an operation of swapping or interchanging the elements position into a particular list. While you are writing a code in Java, you can easily reverse the order of a certain flow. It is a conventional way of any programming language in computer science. The reverse () method is a collection of class which reverses the position of first element to last element. Last element will earn the first position itself after the termination of the process. A list is an interface where the class method is denoted as a signature with ... Read More

Java Program To Reverse A Linked List Without Manipulating Its Pointers

Rudradev Das
Updated on 31-Mar-2023 14:36:14

2K+ Views

Linked List and Pointers In Java Linked list is liner data structure in Java environment, which use to store the elements in an adjacent manner. A linked list contains with some addresses and pointers which are used to create a link between the elements present in a list. There are two types of elements present in a linked list. Those are - data element and address element. The value of an element indicated by the data part where the address part helps to create a link between the elements aka node. In Java there is an another concept of ... Read More

Java Program to Return the Largest Element in a List

Rudradev Das
Updated on 31-Mar-2023 14:31:37

4K+ Views

We can use an array loop to return back the largest element from a list. Primarily this method, known as the comparison model. The maximum number present here in a certain list will be compared with the all elements present in that particular list. The process considers “n” as a number of inputs which will store as data value in an array. After that the program will display the largest element on the output console after refining the loop. In this article today; we will help you to understand and write some Java code by which you can find the ... Read More

Java Program to return the elements at the odd position in a list

Shriansh Kumar
Updated on 01-Aug-2024 11:43:36

928 Views

What is the Odd Position in a List? In Java, a List does not have predefined odd and even positions. However, if one considers the first position as index 0, then an odd position in the given List would be any index that is not divisible by 2. To determine if a position is odd, use the modulo operator (%).   How to Find Elements at Odd Position in a List? Below approaches are followed to find out the elements at the odd position in a list − By dividing index with 2 ... Read More

6 JavaScript Optimization Tips from Google

Biswaindu Parida
Updated on 31-Mar-2023 09:25:57

274 Views

Overview to Java Optimization Java is a popular programming language for developing mobile apps to enterprise-level software systems. However, as the size and complexity of Java applications increase, so does the potential for performance issues. Java optimization identifies and addresses performance bottlenecks in Java applications to ensure they run efficiently and meet the desired performance requirements.  In this article, we will explore the importance of Java optimization and provide an overview of key techniques and best practices for optimizing Java code. We will also discuss common performance issues, how to address them, and the tools and resources available to ... Read More

Java Program to Print Summation of Numbers

Shriansh Kumar
Updated on 30-Sep-2024 15:46:44

823 Views

Suppose you are given a set of numbers, your task is to write a Java program to print their summation. To find summation, you need to add all the given numbers with the help of addition operator. In Java, a set of numbers can be represented by an array. Let's understand the problem with an example − Example Scenario: Input: number_set = 34, 11, 78, 40, 66, 48; Output: summation = 277 Sum of all the numbers is 277 as 34 + 11 + 78 + 40 + 66 + 48 = 277. Using Iteration The most ... Read More

Advertisements