Java Java Java Java.java.class 1 private public package import / //////////////////////////////////////////////////////////////////////////////// // // // // //////////////////////////////////////////////////////////////////////////////// ( ) //////////////////////////////////////////////////////////////////////////////// // T21_1 Turtle // 1 // (2004 4 1 12 34 ) // //////////////////////////////////////////////////////////////////////////////// -1-
package net import ) jp com edu ASCII com edu gov mil net org ISO 3166 1981 2 import API java.awt.color Extension API javax.swing.jbutton API com.sun.j2see.blueprints.cart.model.item API jp.ac.kansai-u.iecs.myclass / / class/interface (static) public protected private public protected private static ( ) ////////////////////////////////////////////////////////////////////// // Abc // // 09-999 (2004 4 1 12 34 ) // ////////////////////////////////////////////////////////////////////// public class Abc { // static public int dumystpb_; static protected int dumystprt_; static private int dumystprv_; // public int dumypb_; protected int dumyprt_; private int dumyprv_; // public // protected // private // public // protected // private // Abc(int x){ this.dumypb_= x; // void printout( ){ System.out.println(this.dumyPb_); // static void printclassname( ){ System.out.println( This class is + Abc ); -2-
a b c d (1) /* */ /* */ ( ) /* abcdefg hijklmn oprs */ (2) // // // ( ) if (foo > 1) { // ( ) x=x+y; else { return false; // /*************************/ /* */ /************************/ /////////////////////////// // // ////////////////////////// -3-
if ( ) { /* */ if (a == 2) { return true; else { return isprime(a); /* */ // a 4 TAB TAB 8 4 ( ) 4 1 80 40 A4 20mm Courier New 10pt Words 1 1 ( A A ( ) B B A x = a + (b + c); a + (b + c) (b + c) ) 2 8-4-
somemethod(longexpression1, longexpression2, longexpression3, longexpression4, longexpression5); // var = somemethod1(longexpression1, // somemethod2(longexpression2, // longexpression3)); // 2 ( ) longname1 = longname2 * (longname3 + longname4 - longname5) + 4 * longname6; longname1 = longname2 * (longname3 + longname4 - longname5) + 4 * longname6; //() 2 2 3 1 8 // somemethod(int anarg, Object anotherarg, String yetanotherarg, Object andstillanother) {... // 2 8 private static synchronized horkinglongmethodname(int anarg, Object anotherarg, String yetanotherarg, Object andstillanother) {... if 4 8 // if ((condition1 && condition2) (condition3 && condition4 // (4 )!(condition5 && condition6)) { // (4 ) dosomethingaboutit(); // // 1 if ((condition1 && condition2) (condition3 && condition4) // (8 )!(condition5 && condition6)) { // (8 ) dosomethingaboutit(); // 4-5-
// 2 if ((condition1 && condition2) (condition3 && condition4)!(condition5 && condition6)) { // (8 ) dosomethingaboutit(); // 4 3 alpha = (alongbooleanexpression)? beta : gamma; else alpha = (alongbooleanexpression)? beta : gamma; alpha = (alongbooleanexpression) //? beta : gamma; UpperAndLowerCase InterfaceNameImpl Impl firstwordlowercase( ) firstwordlowercase trailingunderscore_ _ UPPER_CASE_WITH_UNDERSCORE _ UpperAndLowerCase AbstractInterfaceName Abstract + ClassNameEndsWithException Exception ReallyLongClassNameEndsWithEx Ex lowercase 1 ( ) int level size /* */ int a b[] /* */ -6-
String username; // String aaa; // Object currententry; // 1 int level; // int size; // "{" "" void mymethod() { int int1 = 0; // int1 int int2; // int2 // int2 if (condition) { int2 = 0; // if int2... void mymethod() { int int1 = 0; // int1 if (condition) { int int2 = 0; // if int2... // int2 if 1 Java for for (int i = 0; i < maxloops; i++)... -7-
Java "(" "{" 1 "" "{" class Sample extends Object { int ivar1; int ivar2; Sample(int i, int j) { // ivar1 = i; ivar2 = j; // int emptymethod() { //... 1 1 argv++; // argc--; // argv++; argc--; // "{" "" 1 "{" "" if-else for 1 { { return ( ) return ( ) // return; return value; return mydisk.size(); -8-
// return (1); return (value); if if-else if else-if else if-else [ ] if ( ) { [ ] if ( ) { else { [ ] if ( ) { else if ( ) { else{ if { if ( ) // { if ( ) { // for for for ( ; ; ) { for for ( ; ; ){ // ( )for for ( ; ; ) ; for ( ; ; ) ; for ( ; ; ){ for, 3 for for for ( ) for (expr1; expr2; expr3) // ; -9-
while while while ( ) { while while ( ){ // 3 while ( ) ; while ( ) ; while ( ) { do-while do-while do { ; while ( ); switch switch switch ( ) { case ABC: /* */ // break case DEF case DEF: break; // break switch case XYZ: break; default: break; case break case ( ) break /* */ switch default default break case break -10-
try-catch try-catch try { ; catch (ExceptionClass e) { try-catch try finally try { catch (ExceptionClass e) { finally { 2 1 1 ( ) ( ) Java ( while, for, if ) 1 while (true) { // while... "(" ( ) for (i=0; i<10; i++){ // (for ) x= sin(30.0*math.pi/180.0); // (sin ) -11-
, 1 ( ) Turtle m= new Turtle(200, 200, 180);. "++" "--" ( ) a += c + d; //a,c,d a = (a + b) / (c * d); //a, c d while (d++ = s++) { n++; printsize("size is " + foo + " n"); for ( ) for (expr1; expr2; expr3) // ; ( ) ( ) mymethod((byte)anum, (Object)x); // (byte) mymethod((int)(cp + 5), ((int)(i + 3)) + 1); Java public ( private ) public ( ) static static classmethod(); // ( ) AClass.classMethod(); //. ( ) anobject.classmethod(); //. ( ) for -1 0 1 1 ( ) foobar.fchar = barfoo.lchar = 'c'; // -12-
( ) if ((c++ = d++)!= 0) {... // ( ) ( ) d = (a = b + c) + r; a = b + c; d = a + r; ( ) () // a==b && if (a == b && c == d) // a==b c==d && if ((a == b) && (c == d)) ( ) ( ) if ( ) { return x; return y; if ( ) { return x; else{ return y; -13-
Java < > /////////////////////////////////////////////////////////////////////////////// // < ( ) > // ABC // < > // 03-999 (2004 4 1 12 34 ) // /////////////////////////////////////////////////////////////////////////////// package sample; import java.awt.*; //<package ( )> //< import > ( ) // ( ) public class Abc { /* <1 > */ static public int dumystpb_; // public < // > // < > static protected int dumystprt_; // protected static private int dumystprv_; // private // < > // < ( ) > public int dumypb_; // public protected int dumyprt_; // protected private int dumyprv_; // private /**********************************************************/ /* < > */ /* < > */ /*********************************************************/ Abc(int x){ this.dumypb_= x; ////////////////////////////////////////////////////////// // < > // // < > // ////////////////////////////////////////////////////////// void printout( ){ System.out.println( this.dumypb_); /****************************************************************/ /* */ /* < // /* */ > */ /***************************************************************/ static void printclassname( ){ System.out.println( This class is + ABC ); [1] Java http://www.tcct.zaq.ne.jp/ayato/programming/java/codeconv_jp/index.html -14-
-15-2004 5 13