随笔分类 -  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 阅读全文
posted @ 2020-09-30 08:34 longlong6296 阅读(65) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-29 09:16 longlong6296 阅读(113) 评论(0) 推荐(0)
摘要:Given a class named Range. It represents a range from A (inclusive) to B (exclusive). The class implements the interface Iterable, therefore, an insta 阅读全文
posted @ 2020-09-28 14:39 longlong6296 阅读(98) 评论(0) 推荐(0)
摘要:You're dealing with a string consisting of brackets. Write a program to examine whether the pairs of "{", "}", "(", ")", "[", "]" are correct or balan 阅读全文
posted @ 2020-09-28 12:24 longlong6296 阅读(138) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-28 11:08 longlong6296 阅读(218) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-28 08:50 longlong6296 阅读(155) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-27 19:33 longlong6296 阅读(107) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-27 17:46 longlong6296 阅读(156) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-27 14:08 longlong6296 阅读(103) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-27 12:23 longlong6296 阅读(112) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-21 14:33 longlong6296 阅读(243) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-17 18:57 longlong6296 阅读(114) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-16 11:04 longlong6296 阅读(119) 评论(0) 推荐(0)
摘要:Implement checkPublicParameterlessConstructor that returns true if the provided class declares public parameterless constructor and false otherwise. / 阅读全文
posted @ 2020-09-14 14:23 longlong6296 阅读(127) 评论(0) 推荐(0)
摘要:Implement the getPublicFields method that returns String array with names of public fields declared in the class object belongs to. Fields inherited f 阅读全文
posted @ 2020-09-14 09:35 longlong6296 阅读(126) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-09-09 17:39 longlong6296 阅读(123) 评论(0) 推荐(0)
摘要:You are given the enum Operation and the class Account. Their implementations are shown below. The Operation enum: enum Operation { /** * deposit (add 阅读全文
posted @ 2020-09-09 13:46 longlong6296 阅读(244) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-23 18:13 longlong6296 阅读(143) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-23 13:06 longlong6296 阅读(102) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-08-22 18:00 longlong6296 阅读(216) 评论(0) 推荐(0)