Ankitha Reddy

Ankitha Reddy

45 Articles Published

Articles by Ankitha Reddy

Page 5 of 5

How to count unique elements in the array using java?

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 1K+ Views

The interface Set does not allow duplicate elements, therefore, create a set object and try to add each element to it using the add() method in case of repetition of elements this method returns false − If you try to add all the elements of the array to a Set, it accepts only unique elements − Example import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class CountingUniqueElements { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter the size ...

Read More

List top JavaScript Frameworks

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 273 Views

Dojo It is an open source modular JavaScript library came into existence to a develop cross-platform, applications and a websites. It was developed by Alex Russell, Dylan Schiemann and other contributors in 2004. AngularJS AngularJS is an open source web application framework. It was originally developed in 2009 by Misko Hevery and Adam Abrons. It is now maintained by Google. Backbone.js BackboneJS is a lightweight JavaScript library that allows to develop and structure the client side applications that run in a web browser. It offers MVC framework which abstracts data into models, DOM into views and bind these two using ...

Read More

How to check a String for palindrome using arrays in java?

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 9K+ Views

To verify whether the given string is a palindrome (using arrays) Convert the given string into a character array using the toCharArray() method. Make a copy of this array. Reverse the array. Compare the original array and the reversed array. in case of match given string is a palindrome. Example import java.util.Arrays; import java.util.Scanner; public class Palindrome { public static void main(String args[]) { System.out.println("Enter a string "); Scanner sc = new Scanner(System.in); String s ...

Read More

How to add items to an array in java dynamically?

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 11K+ Views

Since the size of an array is fixed you cannot add elements to it dynamically. But, if you still want to do it then, Convert the array to ArrayList object.Add the required element to the array list.Convert the Array list to array.Exampleimport java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class AddingItemsDynamically {    public static void main(String args[]) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter the size of the array :: ");       int size = sc.nextInt();       String myArray[] = new String[size];       System.out.println("Enter elements of the array ...

Read More

Why do Java array declarations use curly brackets?

Ankitha Reddy
Ankitha Reddy
Updated on 30-Jul-2019 729 Views

Curly brackets usually denote sets and ensembles while parenthesis usually in most Algol-based programming languages curly braces are used to declare arrays.

Read More
Showing 41–45 of 45 articles
« Prev 1 2 3 4 5 Next »
Advertisements