java interface exercise

Discover java interface exercise, include the articles, news, trends, analysis and practical advice about java interface exercise on alibabacloud.com

Algorithm Exercise 4---Bubble sort Java Edition

[] Bubblesortresult =px. Bubblesort (score); for(inti=0;i) {System.out.print (Bubblesortresult[i]+" "); } } /** Bubble sort * @param score score (0-10 points) * @return return count array * Description: There are n number, two adjacent number comparison, if the previous number is smaller than the number of the subsequent exchange position, assuming that a minimum number is placed in the most Back to a trip, you need to compare 1~n-1, set the number of times I, each trip compared to 1~n

Java Exercise-001

Package Yufeifei;Import java.io.IOException;Import java.util.*;/*** @author Yufeifei* @version November 15, 2017 2:55:55* Class Description* Java Operation cmd command*/public class testCMD {public static void Main (String agrs[]) {/** Start Night God simulator */String yeshen = "Nox.exe";/**ADB Connecting device */String command = "adb connect 127.0.0.1:62007";/** Start appium*/String appium = "Appium-a 127.0.0.1-p 4723-u 127.0.0.1:62001";try {Runtim

Blue Bridge Cup-basic exercise: Java Sequence sorting problem

The problem description is given a sequence of length n, which arranges the sequence in small to large order. 1The second row contains n integers, and the absolute value of each integer is less than 10000 for the number to be sorted. Output format output one line, the sorted sequence is output in order from small to large. Sample Input 5 8 3 6 4 9 Sample output 3 4 6 8 9 Collection Sort:Importjava.util.ArrayList;ImportJava.util.Comparator;Importjava.util.List;ImportJava.util.Scanne

JAVA interface and abstract class, JAVA interface abstract class

JAVA interface and abstract class, JAVA interface abstract class For object-oriented programming, abstraction is one of its major features. In Java, OOP abstraction can be embodied in two forms: interfaces and abstract classes. I. abstract class If a class contains an abstra

The Java Cycle Exercise 2

Practice 1:1 people very unlucky, accidentally smashed a woman's basket of eggs. Ask how many eggs are in the basket for compensation.The woman said, she is not clear, only remember to take two each time one, each take 3 is left 2,Take 5 each time Left 4, if each egg 1 yuan, ask you to help programming, calculate the minimum should pay how much money?Requirements: With the Loop statement implementation, directly print out the results do not give points.Package Com.cdp.project;public class Task1

Java Inheritance Little Exercise

Write a class a, the object created by the class can call the method F output lowercase English alphabet. ThenThen write a subclass B of class a , requiring subclass b to inherit the method F of class a (Overrides are not allowed), The object created by subclass B can not only call the method F output lowercase English alphabet, but also can call the childClass New Method g output uppercase English alphabet. Finally write the main class C, the main method in the master classTest class A with

Java Collection exercise: Create a Map collection, create an EMP object, and add the created EMP object to the collection

PackageCom.jihe; Public classEMP {PrivateString e_id; PrivateString E_name; PublicEmp (String e_id, String e_name) {Super(); This. e_id =e_id; This. E_name =E_name; } PublicString gete_id () {returne_id; } Public voidsete_id (String e_id) { This. e_id =e_id; } PublicString Gete_name () {returnE_name; } Public voidsete_name (String e_name) { This. E_name =E_name; } } PackageCom.jihe;ImportJava.util.*; Public classEmpmap { Public Static voidMain (string[] args) {MapNewHashMap

Java object-oriented small exercise

Public classRenwu { Public Static voidMain (string[] args) {Xiyoujirenwu renwu1=NewXiyoujirenwu (); Renwu1.name="Monkey King"; Renwu1.wuqi="Golden Cudgel"; Renwu1.printname (); Renwu1.printwuqi (); Xiyoujirenwu RENWU2=NewXiyoujirenwu (); Renwu2.name="Pig"; Renwu2.wuqi="Iron Rake"; Renwu2.printname (); Renwu2.printwuqi (); }} Public class Xiyoujirenwu { String name; String Wuqi; void Printname () { System. out. println (" Monkey man "+name);

Java Loop exercise: output of a number that cannot be divisible by 3 in a 100--200, with every four line output

Package com.eduask.circulationdemo;/* * * 1. Output of 100--200 that cannot be divisible by 3, Output */public class TestDemo01 {public static void m per four newline Ain (string[] args) {int j = 0;for (int i=100; iOperation Result:100101103104106107109110 112113115116118119121 122124125127128130131 133134136137139140142 143145146148149151152 154155157158160161163 164166167169170172173 175176178179181182184 185187188190191193194 196197199200 Java Loop

Java loop exercise: guessing games

Package Practicego;import java.util.scanner;/* * 6, the computer randomly generated a number of 0~9, the user to guess the number.The value is correct until it is guessed correctly. */public class Cto {public static void main (string[] args) {Scanner sc = new Scanner (system.in), while (true) {System.out.pri NTLN ("Guess number:"), int pernum = Sc.nextint (), int sysnum = (int) (Math.random () *10), if (Sysnum = = Pernum) {System.out.println (" Congratulations, you guessed it!! "); break;}}}Test

OJ Exercise: simple password cracking (Java Case conversion)

oh.InputYUANzi1987Outputzvbo941987EffectCapitalize lowercase and turn backward one bit, lowercase to number, number fixedCodeImport Java.util.Scanner; Public classMain { Public Static void Main(string[] args) {String s=NewString ();CharC Scannerinch=NewScanner (System.inch); while(inch. Hasnext ()) {s=inch. nextline ();Char[] ch = s.tochararray (); for(intI=0; Iif(ch[i]' Z 'ch[i]>=' A ') {ch[i]+=1; Ch[i]=character.tolowercase (Ch[i]); }Else if(ch[i]==' Z ') {ch[i]=' A '; }Else{if

Java Copy Picture exercise

failed");} Try{if (Fos!=null) Fos.close ();} catch (IOException e) {throw new RuntimeException ("write stream object shutdown failed");}}} /**/public static void Copypicarr () {FileInputStream Fis=nulL FileOutputStream fos=null;try{fis=new fileinputstream ("d:\\ picture \\20.jpg"); Fos=new fileoutputstream ("d:\\ picture \\22.jpg" ) int len;byte[] B=new byte[1024];while ((Len=fis.read (b))!=-1) {fos.write (B,0,len);}} catch (IOException e) {throw new RuntimeException ("Copy Failed");} Finally{t

Beginner java--Method Overloading Exercise

Package Shengji; Public class muban { String baobaoming; String baobaoleixing; String Baobaoxingbie; Public void Shengji (String A) { System.out.print ("Your" +baobaoxingbie+baobaoleixing+ "Baby" + baobaoming+ "level has been upgraded to" +a+ "level! "); } Public void Shengji () { System.out.print ("aaaaaaaaaaaaaaaaa");} } Package Shengji; Public class Ciwei { publicstaticvoid main (string[] args) { muban Ciwei= New muban (

Java program exercise: x-binary to Y-binary

/*x binary to y conversion * //*step1. Prompting the user to enter data into the X*STEP2. Receive user input data, save to X* Scanner Method*step3. Receive user input X-data, save to Num*step4. Prompting the user to enter the output data in the binary y*step5. Receive user input data, save to Y* Scanner Method*step6. Decimal = Each one on the (coefficient *x^ power) added, save to a* x-binary Conversion decimal*step7.y binary =a/y, take the remainder until the quotient is zero, the remainder is

Java Fundamentals Enhanced IO flow Note 44:io 4 ways to copy pictures from a stream exercise case

, Len); the } - Wuyi bos.close (); the bis.close (); - } Wu - // byte buffer stream reads and writes one byte at a time About Private Static voidMethod3 (file srcfile, file destfile)throwsIOException { $Bufferedinputstream bis =NewBufferedinputstream (NewFileInputStream ( - srcfile)); -Bufferedoutputstream BOS =NewBufferedoutputstream ( - NewFileOutputStream (DestFile)); A + intby = 0; the while(by = Bis.read ())! =-1) { - Bos.write (by); $

Java daily Exercise (ii) format output with DecimalFormat

ImportJava.text.DecimalFormat;ImportJava.text.NumberFormat;/** Output: A, A, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, 44. A, a, a, and A; */ Public classOutputpattern { Public Static voidMain (string[] args) {//DecimalFormat formatted outputDecimalFormat Dfnum =(DecimalFormat) numberformat.getinstance (); Dfnum.applypattern ("00"); for(inti = 2; I ) { if(i% 10! = 0) {System.out.print (Dfnum.format (i)+ "A"); } Else{System.out.print (Dfnum.format (i)+ "A"); System.o

Java Programming Ideas 4th Edition fourth Chapter exercise 10

Title: Vampire numbers are numbers with an even number of digits that can be multiplied by a pair of numbers, which each contain a number of half-digits of the product, where the number selected from the initial number can be arbitrarily sorted. Numbers ending in two 0 are not allowed, for example, the following numbers are "vampire" numbers:1260=21*601827=21*872187=27*81Write a program to find out 4-digit numbers of all vampires./** *   Java Programm

Algorithm note _062: Blue Bridge cup exercise minimum product (basic type) (Java)

=Getminarray (A); MAXB=Getmaxarray (B); } Else{result+ = A[mina] *B[MAXB]; A[mina]= 2000;//indicates that this element is already in useB[MAXB] = 2000; //after a set of data is obtained, the maximum and minimum values for A and B are updatedMinA =Getminarray (A); MAXB=Getmaxarray (B); MaxA=Getmaxarray (A); MINB=Getminarray (B); } } returnresult; } Public Static voidMain (string[] args) {main test=NewMain (); Scanner in=NewScanner (system.in); //System.out.println ("Please e

java-Array Exercise 5

5. Enter a positive integer n from the keyboard, according to the following five-Yang Hui triangle display method,Outputs the first n rows of the Yang Hui Triangle. Use loop control statements to implement.(The number on the waist of the triangle is 1, and the number of the other position is the sum of the two adjacent rows.) )11 11 2 11 3 3 11 4 6) 4 11 5 10 10 5 1Scanner sc=new Scanner (System. in);System. out. println ("Enter a number to print Yang Hui triangle:");int t=sc.nextint ();int []

Java Programming Ideas Chapter 11th Exercise 16

Creates a set of vowel letters. For Uniquewords.java operations, counts and displays the number of vowels in each input word and displays the sum of all the vowels in the input file. Public classVOWELS6 {Static voidVowelcounter (setSt) {SetNewTreeset(); Collections.addall (Vowels,' A ', ' e ', ' I ', ' o ', ' u ', ' a ', ' e ', ' I ', ' o ', ' u '); intAllvowels = 0; for(String s:st) {intCount = 0; for(Character V:s.tochararray ()) {if(Vowels.contains (v)) {count++; Allvowels++; }} System.out.

Total Pages: 15 1 .... 4 5 6 7 8 .... 15 Go to: Go

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.