ACCP3.0 Java programming foundation. Post-class exercises

xiaoxiao2021-03-06  94

November 4, 2004 P43 T1PUBLIC CLASS TEST {public static void main (string [] args) {for (int i = 4; i> 0; i -) {for (int J = 0; j

/ ** * @Author lileltp * * Todo To change this generated type annotation template, go to * Window - Preference - Java - Code - Code Template * / Interface Vehicle {Void Start (int x); Void Stop (int y);} Class Bus Implements Vehicle {

/ * (Non-javadoc) * @see vehicle # start (int) * / public void start (int x) {// TODO automatic generation method stub}

/ * (Non-javadoc) * @see vehicle # stop (int) * / public void stop (int y) {// TODO automatic generation method stub}} Class Bike Implements Vehicle {

/ * (Non-javadoc) * @see vehicle # start (int) * / public void start (int x) {// TODO automatic generation method stub system.out.println ("This is a Bike method START" x); }

/ * (Non-javadoc) * @see vehicle # stop (int) * / public void stop (int y) {// TODO automatic generation method stub}} public class interfaceDemo}} PUBLIC CLASS interface

Public static void main (string [] args) {bike a = new bike (); a.Start (5);}}} P109 T1, 2 / * * Create Date 2004-11-5 * Judging whether the input is a BYTE type. * // ** * @Author Lileltp * * / Import javax.swing.joptionpane; public class checkbyte {void checkBytedemo (string s) {try {byte b = byte.parsebyte (s); // Convert to Byte type, if Unusually throwing abnormality system.out.println ("this is byte.");} Catch (NumberFormatexception E) {system.out.println ("You Input is not byte");}}}} public static void main (String " ] args) throws bytesizeException {string s = jopptionpane.showinputdialog ("please input"); checkbyte demo = new checkbyte (); demo.checkbytedemo (s);

} Class BytesizeException Extends Exception {Public BYTESIZEEXCEPTION () {Super ();}}}

转载请注明原文地址:https://www.9cbs.com/read-96093.html

New Post(0)