Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java×÷Òµ03

package homework03;
import java.util.Scanner;
/*
* ±àдһ¸öÀ࣬¸ÃÀàÓÐÒ»¸ö·½·¨
* public int f£¨int a£¬int b£©{
*
* }
* È»ºó±àдһ¸ö¸ÃÀàµÄ×ÓÀ࣬ҪÇóÖØд·½·¨f()£¬¶øÇÒÖØдµÄ·½·¨½«·µ»ØÁ½¸öÕûÊýµÄ×îС¹«±¶Êý¡£ÒªÇó£º
* ÔÚÖØдµÄ·½·¨µÄ·½·¨ÌåÖÐÊ×Ïȵ÷Óñ»Òþ²ØµÄ·½·¨·µ»ØaºÍbµÄ×î´ó¹«Ô¼Êým,È»ºó½«a*b/m·µ»Ø£»ÔÚÓ¦ÓóÌÐòµÄ
* Ö÷ÀàÖзֱðʹÓø¸ÀàºÍ×ÓÀà´´½¨¶ÔÏ󣬲¢·Ö±ðµ÷Ó÷½·¨f()¼ÆËãÁ½¸öÕýÕûÊýµÄ×î´ó¹«Ô¼ÊýºÍ×îС¹«±¶Êý¡£
*/
class Father{
public int f(int a,int b){ //·µ»Ø×î´ó¹«Ô¼Êý
int r;
do {
if (a < b) {
int t = a;
a = b;
b = t;
}
r = a % b;
a= b;
b = r;
} while (r != 0);
return a;
}
}
class Son extends Father{
public int f(int a,int b){ //ÖØд¸¸ÀຯÊýpublic int f(int a,int b);·µ»Ø×îС¹«±¶Êý¡£
return a*b/super.f(a, b);
}
}
public class ch05_1 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("ÇëÊäÈëµÚÒ»¸öÕûÊý : ");
int a = s.nextInt();
System.out.println("ÇëÊäÈëµÚ¶þ¸öÕûÊý : ");
int b = s.nextInt();
System.out.println("Óɸ¸ÀàµÄ·½·¨¼ÆËãµÄ×î´ó¹«Ô¼Êý£º"+new Father().f(a,b));
System.out.println("ÓÉ×ÓÀàÖØдµÄ·½·¨¼ÆËãµÄ×îС¹«±¶Êý£º"+new Son().f(a, b));
}
}

ÔËÐÐʾÀý£º
ÇëÊäÈëµÚÒ»¸öÕûÊý :
12
ÇëÊäÈëµÚ¶þ¸öÕûÊý :
9
Óɸ¸ÀàµÄ·½·¨¼ÆËãµÄ×î´ó¹«Ô¼Êý£º3
ÓÉ×ÓÀàÖØдµÄ·½·¨¼ÆËãµÄ×îС¹«±¶Êý£º36
package homework03;
/*
* Ê×Ïȱàдһ¸ö³éÏóÀ࣬ҪÇó¸ÃÀàÓÐÈçÏÂ3¸ö³éÏó·½·¨£º
* public abstract void f(int x);
* public abstract void g(int x,int y);
* public abstract double h(double x);
* È»ºó·Ö±ð¸ø³ö¸ÃÀàµÄ3¸ö×ÓÀà¡£ÒªÇó£ºÔÚÓ¦ÓóÌÐòµÄÖ÷ÀàÖÐʹÓÃÕâЩ×ÓÀà´´½¨¶ÔÏó£¬È»ºóÈÃËüÃǵÄ
* ÉÏתÐͶÔÏóµ÷Ó÷½·¨£ºf(),g()ºÍh()¡£
*/
abstract class F{
public abstract void f(int x);
public abstract void g(int x,int y);
public abstract double h(double x);
}
class s1 extends F{
public void f(int x) {
System.out.println("×ÓÀà1µÄfº¯Êý ´òÓ¡²ÎÊý£º"+x);
}
public void g(int x, int y) {
System.out.println("×ÓÀà1µÄgº¯Êý ´òÓ¡²ÎÊý(int)x=£º"+x+" y="+y);
}


Ïà¹ØÎĵµ£º

JavaÓïÑÔÊä³ö¾Å¾Å³Ë·¨±í

public class Multiplication
{
      public static void main(String[] args)
     {
          // TODO Auto-generated method stub
          for(int i = 1; i < 10; i+ ......

Java ÖжÓÁеÄʹÓÃ

¸Õ²Å¿´¼ûȺÀïµÄÒ»¸öÅóÓÑÔÚÎʶÓÁеÄʹÓã¬È·ÊµÔÚÏÖʵµÄд´úÂëÖкÜÉÙʹÓöÓÁеģ¬·´ÕýÎÒÊÇ´ÓÀ´Ã»Ê¹Óùý¡£Ö»ÊÇѧÊý¾Ý½á¹¹µÄʱºòѧ¹ý¡£
ÏÂÃæÊÇÎÒдµÄÒ»¸öСÀý×Ó£¬Ï£ÍûÓв»×ãÖ®´¦ÇëÌá³ö¸ÄÕý¡£O(∩_∩)O~
¿´´úÂ룺
import java.util.LinkedList;
import java.util.Queue;
public class TestQueue
{
/**
* @param ......

Java·ºÐÍ

Java·ºÐÍ
ÓÉC++µÄÄ£°åº¯ÊýÒýÈë×Ô¶¨Òå·ºÐÍ
ÈçϺ¯ÊýµÄ½á¹¹ºÜÏàËÆ£¬½öÀàÐͲ»Í¬£º
int add(int x, int y) { return x + y;}
float add(float x, float y) { return x + y;}
double add(double x ,double y) {return x + y;}
C++ÓÃÄ£°åº¯Êý½â¾ö£¬Ö»Ð´Ò»¸öͨÓ÷½·¨£¬Ëü¿ÉÒÔÊÊÓ¦¸÷ÖÖÀàÐÍ£¬Ê¾Òâ´úÂëÈçÏ£º
T add(T x, T y) ......

Ô¤±¸ÌṩJavaÆåÀàÓÎÏ·ºÏ¼¯°ü

ÕâÊÇÒ»¸ö·Ç³£¼òµ¥µÄJavaÆåÀàÓÎÏ·£¨ßÀ£¬²»Ð¡ÐÄÑ¡ÁËÒ»ÕÅÕ¼Óÿռä±È½Ï´óµÄ±³¾°Í¼……£©£¬ÎÒÖ´ºì·½£¬µÐÖ´À¶·½£¬Ê×ÏȽ«ÉÏÏ»ò×óÓÒÁ½¶ËÆå×Ó¹áͨÕß¼´ÎªÊ¤Àû£¬ÒÔLGame-Simple-0.2.5¿ª·¢£¨Ô´ÂëÔÚjarÖУ©¡£
ÊÂʵÉÏ£¬ÎÒÃǾ­³£¿ÉÒÔÔÚÍøÂçÖп´µ½ÓÐЩÍøÓÑ·´¸´Ñ°ÕÒÖîÈçÎå×ÓÆ塢ΧÆå¡¢ÏóÆåÖ®ÀàСÓÎÏ·µÄʾÀý³ÌÐò¡£Ã÷Ã÷ÍøÂçÉÏͬÀ ......

JavaµÄʱ¼ä´¦Àí(Ðø)

¸ÅÊö
Èç¹ûÄãÖªµÀÔõÑùÔÚjavaÖÐʹÓÃÈÕÆÚ£¬ÄÇôʹÓÃʱ¼äºÍËü²Å²»¶àÒ»Ñù¼òµ¥¡£ÕâƪÎÄÕ¸æËßÄãÔõÑù°ÑËûÃǵIJî±ðÁªÏµÆðÀ´¡£Robert Nielsen»¹¸æËßÄãÔõÑùʹÓÃjavaÀ´¼ÆËãµÖ´ïº½°àºÍÖÆÔì¹ý³ÌµÄʱ¼ä¡£
×÷ÕߣºRobert Nielsen
·­Ò룺Cocia Lin
ÕâƪÎÄÕÂÊÇÔÚÎÒ·¢±í¹ýµÄ<¼ÆËãJavaʱ¼ä>(ÒëÕß:ÒѾ­·­ÒëÍê³É)µÄ»ù´¡Éϵġ£ÔÚÕâÀΠ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ