随笔分类 - Java 练习题总结
摘要:Sometimes after mapping and filtering a stream, you need to use it more than one time. For example, find the maximum and count all the elements of a r
阅读全文
摘要:Implement a method for finding min and max elements of a stream in accordance with a given comparator. The found elements pass to minMaxConsumer in th
阅读全文
摘要:Given a class named Range. It represents a range from A (inclusive) to B (exclusive). The class implements the interface Iterable, therefore, an insta
阅读全文
摘要:You're dealing with a string consisting of brackets. Write a program to examine whether the pairs of "{", "}", "(", ")", "[", "]" are correct or balan
阅读全文
摘要:Some info: HTML is a markup language, that is based on tags. There are many types of tags, for example, html, div, h1, h2. Each type of tag has start
阅读全文
摘要:Write a program simulating a stack that can effectively return the current max element. Your program should read a sequence of commands of different t
阅读全文
摘要:The simplest spell checker is the one based on a list of known words. Every word in the text is being searched for in this list and, if such word was
阅读全文
摘要:You have a table of integer numbers. You should rotate rows of the table by the specified distance. Try to use collections and standard methods for th
阅读全文
摘要:Write a program that reads the list of integer numbers separated by spaces from the standard input and then remove all numbers with even indexes (0, 2
阅读全文
摘要:Has it ever bothered you when unknown people call you and try to impose their services? That can be annoying. Let's try to solve the problem by using
阅读全文
摘要:The normal way to create an instance of a class is to use a public constructor of the class. But there is another technique. A class can provide a pub
阅读全文
摘要:You are given a Callable object. Some say that it returns another Callable object. And that Callable returns another Callable object! And so on. You s
阅读全文
摘要:Implement a method that takes three objects (instances of Thread or its subclasses). The method must start passed objects as threads in a way that the
阅读全文
摘要:Implement checkPublicParameterlessConstructor that returns true if the provided class declares public parameterless constructor and false otherwise. /
阅读全文
摘要:Implement the getPublicFields method that returns String array with names of public fields declared in the class object belongs to. Fields inherited f
阅读全文
摘要:Here's a class named Employee with three fields: name, salary, address. Add three constructors to the class: the first one is the no-argument construc
阅读全文
摘要:You are given the enum Operation and the class Account. Their implementations are shown below. The Operation enum: enum Operation { /** * deposit (add
阅读全文
摘要:Read an input text from the console and print the number of words. By word we mean a sequence of characters separated by one or several spaces. If the
阅读全文
摘要:Imagine that we have a typing machine that accepts only one letter at a time for writing, but we want to write an array of words instead. public class
阅读全文
摘要:Write a program searching for passwords in a given text. It is known that: a password consists of digits and Latin upper- and lowercase letters; a pas
阅读全文

浙公网安备 33010602011771号