- 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
Venkata Sai has Published 62 Articles
Venkata Sai
15K+ Views
To find the product of elements of an array.create an empty variable. (product)Initialize it with 1.In a loop traverse through each element (or get each element from user) multiply each element to product.Print the product.Example Live Demoimport java.util.Arrays; import java.util.Scanner; public class ProductOfArrayOfElements { public static void main(String args[]){ ... Read More
Venkata Sai
2K+ Views
To rotate the contents of an array cyclically −create an empty variable. (temp)save the last element of the array in it.Now, starting from the nth element of the array, replace the current element with the previous element.Store the element in temp in the 1st position.Example Live Demoimport java.util.Arrays; import java.util.Scanner; public ... Read More
Venkata Sai
781 Views
Following is a Java program to find an element in an array linearly.Example Live Demoimport java.util.Scanner; public class SearchingRecursively { public static boolean searchArray(int[] myArray, int element, int size){ if (size == 0){ return false; } if ... Read More
Venkata Sai
353 Views
To generate a sum triangle of a given arrayGet the elements of the array from the user say, myArray[n].Create a two dimensional array say, result[n][n].Store the contents of the given array in the first row from bottom of the 2D array.result[n][i] = myArray[i].Now, from the second row of the 2D ... Read More
Venkata Sai
501 Views
To arrange elements of the array following pendulum arrangement.Sort the given array, create an empty array to store the result.Store the 0th element in a variable say temp.Store the element at index 1 in the sorted array in (mid+1)st position of the resultant array, and the next element int the ... Read More
Venkata Sai
2K+ Views
Following is a Java program to print the spiral form of a given matrix.Example Live Demopublic class PrintMatrixInSpiralForm { public static void main(String args[]){ int a[][]={{1,2,3},{4,5,6},{7,8,9}}; int w = 0; int x = a.length-1; int y = 0; int z = a[0].length-1; while(w
Venkata Sai
667 Views
Following is the Java program to print diagonal pattern of a given matrix.Example Live Demopublic class DiagonalMatrix { public static void main(String args[]){ int a[][]={{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int rows = a.length; int columns = a[0].length; ... Read More
Venkata Sai
4K+ Views
You can convert a character to upper case using the toUpperCase() method of the character class.ExampleFollowing program converts alternate characters of a string to Upper Case. Live Demoimport java.util.Scanner; public class UpperCase { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ... Read More
Venkata Sai
269 Views
In Java, serialization is a concept using which we can write the state of an object into a byte stream so that we can transfer it over the network (using technologies like JPA and RMI).While serializing an object of a class, if you want JVM to neglect a particular instance ... Read More
Venkata Sai
261 Views
The Arrays class of the java.util package provides a method named toString() this method accepts an array value (of any type) and returns a String.ExampleFollowing Java program accepts various arrays from the user, converts them into String values and prints the results. Live Demoimport java.util.Arrays; import java.util.Scanner; public class ObjectArrayToStringArray { public ... Read More
To Continue Learning Please Login
Login with Google