Java Assignments Aspire

 

Question 1Search for a name

Write a program to accept an array of names and a name and check whether thename is present in the array. Return the count of occurrence. Use the followingarray as input

{“Dave”, “Ann”, “George”, “Sam”, “Ted”, “Gag”, “Saj”, “Agati”, “Mary”, “Sam”,

“Ayan”, “Dev”, “Kity”, “Meery”, “Smith”, “Johnson”, “Bill”, “Williams”, “Jones”,

“Brown”, “Davis”, “Miller”, “Wilson”, “Moore”, “Taylor, “Anderson”, “Thomas”,

“Jackson”}

import java.util.*;import java.io.*;class name_search //class to search the names in the given input{String[] input;//string array to store the inputint length=0;public void ArrayBub(int MAX)//method to define the size of array{input = new String[MAX];}public void insert(String s)//method to insert the string into the array{input[length]=s;length++;}public int search(String key)//method to search the name based on the key provided{int i=0;int count=0;for(i=0;i<length;i++){if(input[i].equals(key))count++;}return count;}public void display()//method to display the contents of array{int i;System.out.println();System.out.println("The input names are:");System.out.println();

Java Programming Exercises, Practice, Solution

Java Exercises

Java is the foundation for virtually every type of networked application and is the global standard for developing and delivering embedded and mobile applications, games, Web-based content, and enterprise software. With more than 9 million developers worldwide, Java enables you to efficiently develop, deploy and use exciting applications and services.

The best way we learn anything is by practice and exercise questions. Here you have the opportunity to practice the Java programming language concepts by solving the exercises starting from basic to more complex exercises. A sample solution is provided for each exercise. It is recommended to do these exercises by yourself first before checking the solution.

Hope, these exercises help you to improve your Java programming coding skills. Currently, following sections are available, we are working hard to add more exercises .... Happy Coding!

Note: If you are not habituated with Java programming you can learn from the following :

More to Come !

Popularity of Programming Language
Worldwide, Mar 2018 compared to a year ago:

Source : http://pypl.github.io/PYPL.html

TIOBE Index for March 2018

Source : https://www.tiobe.com/tiobe-index/

List of Exercises with Solutions :

  • HTML CSS Exercises, Practice, Solution
  • JavaScript Exercises, Practice, Solution
  • jQuery Exercises, Practice, Solution
  • jQuery-UI Exercises, Practice, Solution
  • CoffeeScript Exercises, Practice, Solution
  • Twitter Bootstrap Exercises, Practice, Solution
  • C Programming Exercises, Practice, Solution
  • C# Sharp Programming Exercises, Practice, Solution
  • PHP Exercises, Practice, Solution
  • Python Exercises, Practice, Solution
  • Java Exercises, Practice, Solution
  • SQL Exercises, Practice, Solution
  • MySQL Exercises, Practice, Solution
  • PostgreSQL Exercises, Practice, Solution
  • SQLite Exercises, Practice, Solution
  • MongoDB Exercises, Practice, Solution
  • Euler Project

[ Want to contribute to Java exercises? Send your code (attached with a .zip file) to us at w3resource[at]yahoo[dot]com. Please avoid copyrighted materials.]

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *