Javase Programming Questions

Source: Internet
Author: User
Tags instance method wrapper

test1– the number of occurrences of a letter in a string. such as: string: "Abcdekka27qoq", the output format is: A (2) B (1) k (2) ...

test2– If we need to model an employee when we develop a system, the employee contains 3 attributes: Name, work number, and salary. "Manager" is also an employee, in addition to the attributes that contain employees, there is also a bonus attribute. Use the idea of inheritance to design employee and manager classes. Requires that the class provide the necessary methods for property access.

Test3–arraylistlist=newarraylist (); Stores a string object in the ArrayList of the generic type integer.

Test4– has five students, each student has 3 courses (Chinese, maths, English) scores, write a program to receive the information from the keyboard input students, the input format is: name,30,30,30 (name, three class results), and then the input student information in the order from high to low in the sequence to write to a name " Stu.txt "file. Requirements: Stu.txt file format to be more intuitive, open this file, you can see the student's information very clearly.

test5– defines a file input stream, and calls the Read (Byte[]b) method to print all the contents of the Exercise.txt file (the size of the byte array is limited to 5).

test6– the wrapper class of the custom character input stream, which wraps the underlying character input stream through this wrapper class, allowing the program to read a text file (for example, a Java source file) with a line number and colon in front of each line read.

test7– Analysis of the following program running results, explain the principle. (No analysis results are not allowed to be divided)

The test8– reverses the string. Abcde–>edcba

Test9– writes a method of printing a two-dimensional array of equal length, which requires a natural number starting from 1 to be arranged in the order of the outer ring of the square. such as: n=4 print:

test10–28 people buy cola drink, 3 Coke bottle cap can change a bottle of Coke, then how many bottles of Coke to buy, enough 28 people to drink? If it is 50 people, how many bottles of Coke do you need to buy?

Test11– writes a class that defines a map object (with generics) in the main method, joins several objects, and then traverses and prints the key and value of each element.

The inner class in the test12– method can access local variables in the method, why?

test13– defines a traffic light enumeration that contains red, green, and yellow lights and requires a way to get the next light, for example: red light to get the next light is green, green to get the next light is a yellow light.

Test14– writes a class that adds an instance method for printing a string. and use reflection to create an object of that class and invoke the method in that object

test15– copies all the text in the current file into a TXT file, counting the number of occurrences of each character and outputting it, for example: a:21 b:15 times c::15 times: 7 times ...

Test16– writes a program that loops over the user entering multiple strings from the keyboard until the end of the loop is entered, and prints all the entered strings in reverse order.

Test18–1. Write a configuration file in the properties format that configures the full name of the class. Write a program, 2. Read the properties configuration file, get the full name of the class and load the class, and run the Run method in a reflective manner.

test19– single-case mode get setup configuration information

Test20– writes a program that obtains 10 random numbers from 1 to 20, requiring random numbers to be duplicated.

test21– declares a shared array, starting with two threads, two threads separated for a period of time (can write a random number), adding data to the array, and each thread adding 3 data to a set of bytes.

test22– code implementation of a folder C to copy to the D drive, plus code, plus comments, plus ideas.

Test23– writes a proxy for the ArrayList class, implements exactly the same functionality as the ArrayList class, and calculates the time each method runs.

test24– There is a JavaBean, which contains the following properties, 1Booleanboolean

Test25– writes a program that converts a string entered on the keyboard into a decimal integer, and then prints the binary form of the decimal integer. This program takes into account the case that the input string cannot be converted to a decimal integer, and whether the reason for the conversion failure is to distinguish whether the number is too large or if it contains a non-numeric character. Tip: The decimal number to the binary number is the way to divide the number by 2, the remainder is the lowest bit of the binary number, and then used to get the quotient as dividend removed to 2, this time the remainder is the sub-low, so loop, until the divisor is 0 so far. In fact, as long as you understand how to print out a decimal number of each bit of the way (constantly divided by 10, the remainder is the number of bits, 10 bits, hundred), it is easy to understand the decimal numbers to binary number of this way.

est26– is known as an int array, and the elements in the array are sorted in ascending order by bubbling sorting. (The simple question also does not let go)

Test27– Custom Enumeration Week represents the day of the week and requires that each enumeration value have a toLocaleString method. Returns the day of the week in Chinese format.

Test29– writes a program that generates 5 random integers from 1 to 10, stores a list collection, writes a method to sort the list collection (a custom sort algorithm, disables the Collections.sort method, and TreeSet), and then iterates through the collection output

Test30– writes a program that connects each element of an array of integers with a comma to a string, for example, a string that is "all-in-one" based on an array of [1][2][3] content.

test31– amount conversion, Arabic numerals converted into Chinese traditional form. For example: 101000001010 converted to a 0 billion and a 0 a round

test32– Write a program that can list all subdirectories and files in a directory when the user enters it

test33– We're going to give each letter an integer between 1-26,...... To maximize the perfect degree

Test34, using TCP protocol to write a client and a server to implement uploading files

Test35, enter a path to copy all files ending in. txt to a different path under that path (including subfolders)

test36– has 100 people in a circle, starting from 1, reporting 14 of the person will quit. Then others start over, count back from 1, and Exit 14. Q: What is the first of the 100 people left?

Test37– has a class of ClassA, there is a class of CLASSB, there is a method B in ClassB, this method throws an exception, in the ClassA class there is a method A, call B in this method, and then throw an exception. In a client that has a class of TESTC, there is a method for C, please catch the exception information in this method. To complete this example, describe the handling mechanism for exceptions in Java.

test38– the contents of the known file A.txt file are "Bcdeadferwplkou", write the program to read the contents of the file and then output it in a natural order to the B.txt file. That is, the contents of the file in B.txt should be "ABCD ..." In this order.

test39– altogether there are four ticket outlets selling 100 tickets at the same time, please simulate the ticketing process output to show which window to sell the first few tickets.

Test40– declares the class student, which contains 3 member variables: Name, age, score, create 5 objects to load TreeSet, sort the results by score (consider the same issue as the score).

Test41– writes a program that copies all. java files under the specified directory to another destination and changes the extension to. txt.

test42– in the code to prove that in the try to write a return, and then wrote Finally, is the first to execute a return or first execute fianlly?

Test43– writes a function that gets the file name extension, and the parameter receives a file name string that returns an extension string.

test44– determines whether a string is a symmetric string, such as "ABC" is not a symmetric string, "ABA", "ABBA", "AAA", "MNANM" are symmetric strings

The test45– program calculates the 12+22+32+....+1002 and.

test46-a ArrayList object alist contains several string elements and is now traversing the ArrayList object, removing all string elements of which the value is "ABC", implemented in code.

Test47-writes a method that sets the value of the property named Propertyame in the Obj object to

test49-the following IP into a TXT file, the program to write these IP values, from small to sort and print out

Test50-write a function that intercepts a portion of a string in bytes, but cannot intercept half of the Chinese (GB Code table)

test52-Please list some of the sorting algorithms you know, and use the Java language to implement a highly efficient

Test53-accepts a number from the keyboard, prints the time that the number represents, the maximum unit to day, for example: keyboard input 6, print 6 seconds, keyboard input 60, print 1 minutes, keyboard input 66, print 1 minutes 6 seconds, keyboard input 666, print 11 minutes 6 seconds; keyboard input 3601, print 1 hours 1 seconds

test54-Programming Prints all 3-bit prime numbers, Prime features: can only be divisible by 1 and its own

The test55-uses a console program to reverse the Output 99 multiplication table, and the output results are as follows:

The test56-decomposes a positive integer factorization. Example: Enter 90, print out 90=2335

test57-input a line of characters, respectively, the number of letters, spaces, numbers and other characters.

test58-the value of S=A+AA+AAA+AAAA+AA...A, where a is a number. For example 2+22+222+2222+22222 (there are 5 numbers added at this time), several numbers are added with keyboard control.

test59-have 1, 2, 3, 4 digits, how many different and no repetition of the number of three digits? How much are they?

The test60-gives a positive integer not more than 5 bits. Requirements: First, it is a number of digits, two, reverse order to print out the figures.

TEST61-100 7 of the number within the

test62-Keyboard Input 5 number, stored in an array, take the maximum and minimum values.
test63-three-digit prime number, can only be divisible by itself and 1!!!

Test64-write a class independently, imitating the ArrayList, you need to implement add,get,remove and other methods. @author 李杨

test65-determines how many primes are in between 101-200. (The prime is that it cannot be expressed as a product of any other two integers other than the product of its own and 1)

Turn from: 53431988

Javase Programming Questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.