˹á
 úҹ
  C/C++ new
  Java new
 Sourcecode.TV
  Android
  Blackberry
  C/C++
  Java
  Linux
  Windows Phone
  ͧͧ
 
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 Ẻ¹
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 ԡèҡ
  Դ...
  DoodeeHosting
  Ѻ͡Ẻ Ѳ䫵
  Freeware
  ѵҤɳ
  ª١
  ʶԵԼ
 Ŵ
 Ң
 дҹʹ
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
 
 дҹҹ
 ԧ
 ǡѺ
 ѵҤɳ
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
 (BerDee)
(Android)
駩غ
駩غ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ԴͺʹФѺ...
2015-07-29 13:35:58
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:33:54
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:32:51
  ԴͺФѺ
ҹ...

2014-01-06 12:47:38
  ѧҤ͹ ͧ֡ͧ...
2013-07-06 01:04:37
  ʹ觢ͺࢵҤҤҡ͹ФѺ...
2013-03-24 18:54:20
  ѧդѺҹԴѺ 08...
2012-12-16 19:18:14
  ʹ㨤 Դ 0905076277...
2012-11-12 11:07:46
  Ѻ礹ѡ֡ͺѷ
...

2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  ͧ gotoxy ѧ...
2017-08-28 11:45:52
  ͧҧա u...
2017-08-27 20:09:01
  #define GLUT_DISABLE_ATEXIT...
2017-08-27 12:53:17
  դԻ͹ ...
2017-08-27 10:50:02
  Ѻ ͹ matlab ¹ matlab...
2017-06-03 16:27:23
  ੾зҧҴ ͧҢ...
2017-05-25 16:18:08
  ͧ˹Ѻ os ...
2017-05-25 16:12:47
  ¹ php curl ...
2017-04-20 01:04:20
  ¹ ...
2017-03-27 12:50:54
  ʧҷ ͧѾഷ...
2017-03-27 12:37:20
  Homework comment
  ͺسҡѺ...
2017-08-16 18:27:25
  ͧ ͧ ѧ ^^...
2017-04-18 18:40:46
  ͧ ͧ ѧ ^^...
2017-04-18 18:37:54
  á flowchart ѹ...
2017-04-18 17:43:33
  ҡ flowchart ...
2017-04-18 16:25:29
  kungking ӶäѺ ?...
2017-03-18 23:28:36
  ¹ʴͧ...
2017-03-06 10:56:25
  鴷ӧҹẺ ...
2016-09-06 01:00:12
  ҡҺ鴹Ѻѧ...
2016-09-05 09:31:27
  ͧ֡¹...
2016-04-22 00:47:49
  Article comment
  [b]5 ...
2017-10-18 08:19:17
  - ...
2017-10-18 07:17:11
  [b] ...
2017-10-18 06:07:31
  [b] 96 ...
2017-10-18 06:05:28
  - ...
2017-10-18 05:49:56
  code ͧ VB ú...
2017-09-28 16:50:02
  ҨѺ ͧ
...

2017-07-11 09:59:35
  ö͡Ѻ anycast ...
2017-07-05 10:12:35
  Ѻ س "Դ" ͧ֡...
2016-06-18 15:21:09
  vs2008 c# Ѻ ͺسѺ...
2016-06-17 14:39:30
  9Mcode comment
  ҡ...
2014-02-21 08:52:19

Link Exchange

ѵҤɳ
Statistics of Sourcecode in Thailand
 
ٻẺ 㹡¹⤴ Java (ҹ 61,707)
ѡ ҷ 

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

 
 
FreelanceѺѲ 9'M 

ٻẺ 㹡¹⤴ Java

: ѡ.com ҷ

úѭѺ

  1. Ӥ㨡ѹ͹
  2. çҧ㹡¹
  3. ûСȵҧ
  4. ¹Ӫᨧ (Comment)
  5. ¹⤴

Ӥ㨡ѹ͹

compiler ͧ Java Դҧö¹⤴ٻẺ㴡ҶѴ 觷¹ 觹⤴ͧҡ÷Ӥѧ Java й¹⤴Ƿҧǡѹ ִٻẺ·ش͡÷Ӥ

͡ùǷҧ¹⤴ҹ÷ͺҹҹ¡ѡ¹ ʹͧ ͡ҹ ͻѺѧ ͹Ƿҧ੾ java ҹ鹷 öѹ ա

95% ͧҵðҹ͡ù о code ͧ JDK ǹա硹 Ҩҡõŧѹҧ˹ѡ㹡 programmer ͧ

͡ùФͺ੾лѭҷҨзԴѺʹ ҡзӤ ǹٻẺ繻ѭҡСѹ ҧáҨٻẺǡ鹨áѺ⤴ҧ͡éѺѺ

çҧ㹡¹

˹

˹ҷءѹСҧ 4 ѡ Ѻ˹Ңͧ÷Ѵ͹˹ ÷Ѵͧ


void foo()
{
    while ( bar > 0 )
    {
        System.out.println();
        bar-- ;
    }

    if ( oatmeal == tasty )
    {
        System.out.println("Oatmeal is good and good for you");
    }
    else if ( oatmeal == yak )
    {
        System.out.println("Oatmeal tastes like sawdust");
    }
    else
    {
        System.out.println("tell me pleeze what iz dis 'oatmeal'");
    }

    switch( suckFactor )
    {
        case 1:
            System.out.println("This sucks");
            break;
        case 2:
            System.out.println("This really sucks");
            break;
        case 3:
            System.out.println("This seriously sucks");
            break;
        default:
            System.out.println("whatever");
            break;
    }
}

Ӥѭͷء˹Ҥè繵ѡ tab

˵ؼ : ءöӧҹաѺͧҧ繵ѡ ǹ˭շ駵ѡ tabs 鹷ҧ÷Ѵ˹繵ѡ кҧ÷Ѵ tab 觷Դѭ ҡ˹ tab ҡѺ 4 ѡ ͹ ˹ tab ҡѺ 8 ѡ ⤴ͧҨдٻѭ͹ҡ

ء if, while for еͧ˹ شդ

˵ؼ : ¹⤴㹷ҧǡѹ зµ͡ҹ ҧ¡ѧз·㹡ź


if ( superHero == theTick ) System.out.println("Spoon!");  // NO!

if ( superHero == theTick )  // YES!
{
    System.out.println("Spoon!");
}

ͧҧ

ء ÷˹ҵͧͺ ͧҧ

˵ؼ : ͧͧ͢ҧ ШѴº⤴ кص(identifier) ͤسӡ double click ӹ кҧ double-click-function ͧҧ㹡õǨͺ ѧ鹷ء Ө֧ͧͺªͧҧ


int theTick=5;    //  NO!  Double click would get "TheTick=5;"
int theTick = 5 ;   //  YES!  Double click gets "TheTick"

if (theTick==5)  // NO!  Double click gets "(TheTick==5)"
if ( theTick == 5 )  // YES!  Double click gets "TheTick"

ҧ駡ժͧҧҡ Դѭ㹡÷Ӥ㨡ѺõǨͺ Ҩԧ (boolean) :


if ( ( hero == theTick ) && ( ( sidekick == arthur ) || ( sidekick == speak ) ) )

è¹


boolean isTickSidekick = ( ( sidekick == arthur ) || ( sidekick == speak ) );
if ( ( hero == theTick ) && isTickSidekick )

Ǣͷ١¡ͧӵͧҧ:

¡ ˵ؼ ҧ ҧ
method names

繷ѹҵѧ method еͧǧԴѹ

foo( i );
start();

foo (i);
start ();
array dereferences

繷ѹҵѧ array еͧǧ纡Դѹ

args[0];
tens[ i ];

args [0];
tens [i];
pre- and post-increment and decrement operators 繷ѹҤ unary operator еͧѧ operation ѹ.

++count ;
i-- ;

++ count;
i --;
cast operator

繷ѹ cast еͧ¹ժͧҧ

(MyClass)v.get( 3 );
           

(MyClass) v.get( 3 );
( MyClass )v.get( 3 );

÷Ѵҧ (Blank Line)

÷Ѵҧ¡⤴ method Ѵǹ

÷Ѵ˹ͧ÷Ѵҧ methods

ӴѺͧ⤴ class

    class Order
{
// final attributes
// attributes

// constructors

// methods

}

private methods 鹡͹ method ¡ѹ ͧѧ constructors constructors ѹ

çҧ¹ File

"package" () еͧѹѺá

"import" ѹѺͧ

Ҵ¤Ӻ (comment) Ѻҧ javadoc

ء ͡âͧ javadoc ͨҡ

class ѹѺش

͹䢹੾˹ file ˹ class (¡ inner classes)

Example:


    package misc ;
import java.io.* ; import java.net.* ;
/** this class does cool stuff
@author Joe Programmer */ class SpaceMonkey { ... }

ӹǹѡк÷Ѵ

¹к÷Ѵըйǹѡҡ 120 ѡ ҡҤè¹⤴¡ 80 ѡ˹觺÷Ѵ ж⤴ͧ ˹ҡҡ è¡⤴ǹ鹢ա methods

˵ؼ : Сþ(printing) ҹ⤴¡Ҷк÷ѴԹ 120 ѡ ա駺÷Ѵ ѧҧѭ㹡÷ӧҹѺѹ

ǧ

͡ҡҨǧ͡˹ӴѺ÷ӧҹͧ ѧǧ纷ô٧ ѹբҴ˭ ͫѺ͹

ûСȵҧ (Identifiers)

ء ûС ѡ ('A' ֧ 'Z' 'a' ֧ 'z') еŢ ('0' ֧ '9') ҹ մ('_' : underscores) ͧºҷ ('') ѡ÷ ascii (non-ascii characters)

"Hungarian Notation violates OO abstraction"

Classes interfaces

㹡ûС class interface Ҩѧɷ駵˭е ѡõáͧФ繵˭ (Uppercase) ǵѡõáͧʹ ͡ѡõ硷 ¡Ҩ繵 觵ͧ繵˭ ѡõ˭Ѻ

Examples:

    
    Customer
    SalesOrder
    TargetURL
    URLTarget

Packages

ͧ͢ Package ѡõҹ (lower case) оѡ¡Ỵ (8) ѡ ա§¤㹪 package

Examples:

    
    common
    core
    lang

ѺûС

ء ûСҨ including() attributes, variables, methods parameters 駪ͷҡ 駡ûС final (ѡõ˭ ѹ C ҨТѴѺѡͧ OO ) ѺѡõáͧФѡõ˭ ¡ѡõáͧ ѡ÷ͷ Ҥѡ ѡõ˭ ¡ѡ͹繤áͧ

Examples:

    
    customer
    salesOrder
    targetURL
    urlTarget

; Getters Setters

Methods ˹ҷ˹ʶҹ ѡӹ˹ set 㹪ͧ͢ method

Methods 觤ҵšѺ (return) boolean object ѡӹ˹ is 㹪ͧ͢ method ͡ methods ա觤ʶҹТͧ object Ѻӹ˹ get 㹪 method

Examples:

    
    setEnabled()
    getName()
    isEnabled()

¹Ӫᨧ (Comment)

ӪᨧٻẺ // Ѻشѡ ͧӪᨧ (comment).

ѺӪᨧٻẺ /** */ ҧ javadoc

ӪᨧٻẺ /* */ ѺӪᨧ价ǡѺ⤴

¹Ӫᨧҧ Javadoc

Javadoc ١ҧ͡÷֧͡§ class, attributes and methods ١ classes Ӫᨧеͧ¹ԴѺҵͧ ͡ (javadoc)

Ӫᨧͧ Javadoc Ѻ methods Ӥѭ ҧ

    public static void main( String[] args )

    public int getX()

Ӫᨧ Javadoc Ѻ parameters Ӥѭ ҧ

    public void setX( int newX )

ФӪᨧ Javadoc Ѻ class ͧ Class ҧ servlets EJB's

͹س⤴ͧس سеͧ JavaDoc еͧԴ֧ҧҹѾ ͡âͧسҧ餹ҹ

ҤӪᨧ JavaDoc ö¹˹觺÷ѹس¹ѡɳй:

    /** Used to mark spots */
int x ;

ҤӪᨧ JavaDoc ö¹˹觺÷Ѵ ¹ѡɳй:

   /** Set how much to grow when growth is needed. <p>

Smaller values will usually save memory, but frequent
reallocation may take a lot of time. <p>

@param howMuch The number of extra ints to allocate when
memory reallocation is required. Values must be greater than
zero. <p>
*/
public void setExtra( int howMuch )
{

ö HTML tags <p> <pre> <p> ¶֧ش˹ ǹ <pre> .. </pre> ͡ӡѺǹͧʴѡẺ fixed font ʴͧҧ ( html ʴͧҧªͧªͧ)

JavaDoc ѧس HTML ҧ سͧ س header tags (<h1>, <h2>, etc.) 繡ôն <b>.. </b> ͷӵ˹ <i>.. </i> ᷹§᷹ header tags

JavaDoc еѴ÷ѴáͧӪᨧ͡ ͹繤͸Ժ table of contents ҤͧӶ֧֧ ҤͧԴҨеѴ͹˹ JavaDoc ˹õѴ÷Ѵҧ Ѻͧ¤Ӷªͧҧ <p> tag (÷Ѵҧҧ¤ <p> tag)

شŤѺ :Һ͡
Note that JavaDoc splits out the first line of any JavaDoc comment to use for a sort of "table of contents". You might want to think about where you want this line division to happen. JavaDoc defines this as a period followed by a space. So question marks followed by a space don't count! Nor does a period followed by a <p>tag! Use a space between the period and the <p> tag.

Classes

JavaDoc Ѻ͡͸Ժ class ͧСͺ:

  • ػ Ӥѭ
  • ͸Ժ´
  • ҧ⤴еҧ class
  • ªͧ͢¹ JavaDoc @author tag

"feature" JavaDoc ҵͧͧ´͡ѹ˹Һ÷Ѵѡ˹Ңͧ.

Example:

    /** A vector class optimized for working with ints. <p>

Like the Vector object, except rather than tracking a dynamic
array of pointers to different objects, this is simply a
dynamic array of ints. The advantage is speed and memory
savings.<p>

Example:

<pre>
*
* // report longest lines
* TextFileIn f = new TextFileIn("blather.txt");
* IntVector v = new IntVector();
* int longestLine = 0 ;
* boolean done = false ;
* while ( ! done )
* {
* String s = f.readLine();
* if ( s == null )
* {
* done = true ;
* }
* else
* {
* int sLength = s.length() ;
* if ( sLength > longestLine )
* {
* longestLine = sLength ;
* }
* v.append( sLength );
* }
* }
* f.close();
* System.out.println("The longest lines are on line numbers:");
* for ( int i = 0 ; i < v.length() ; i++ )
* {
* if ( v.get( i ) == longestLine )
* {
* System.out.println( i );
* }
* }
</pre>

@author Adam Baum
@author Justin Case
*/
public class IntVector
{

Methods

Ѻ method ͧ͡ JavaDoc еͧ:

  • ػӤѭͧ method
  • ء͸Ժ´ (ҡҷŧ)
  • ¡âͧ prameter ¹ٻẺ @param tag ( parameters)
  • ҷ觡Ѻ (return) ¹ٻẺ @return tag ( returned)
  • ¡âͧҼԴҴѺ (exception) ¹ٻẺ @exception tag ( exceptions ͡)

Example:


    /** Get a copy of one int. <p>

        Retrieve an int relative to the index provided.<p>

        @param Index Which int (0 is the first int).<p>
        @return The retrieved int or zero if Index is outside of 0..length.<p>

    */
    public int get( int Index )
    {

Ƿҧ÷բͧ document code

"Ҩ˹ö¹⤴.
programmer ըеͧ¹⤴餹"

        --- Martin Fowler, Refactoring: Improving the Design of Existing Code

Ҥس¹͡͸Ժ algorithm Ѻ͹ͧس ¹繾¹ algorithm ͧس ¡ô֧觷Ѻ͹͡һСȡ͹С͹ 觹ЪŴѺ͹ͧ algorithm ûѺ Сҹ 繵ͧ¹͡͸Ժǹ

ҧ:

    
    /** determine if the given year is a leap year. <p>

        The Gregorian calendar principal states that a leap year occurs
        every fourth year, except every 100 years, except every 400
        years. <p>

        If the year is evenly divisible by 400 or is evenly divisible by
        4 and not by 100, then it is a leap year. <p>

        @param year The year to be tested.  Make sure this is a 
                    four digit year!<p>
        @return true if "year" is a leap year. <p>
    */
    boolean isLeapYear( int year )
    {
        return ( ( ( y % 400 ) == 0 ) || ( ( ( y % 4 ) == 0 ) && 
               ( ( y % 100 ) != 0 ) ) );
    }

:

    /** determine if the given year is a leap year. <p>

The Gregorian calendar principal states that a leap year occurs
every fourth year, except every 100 years, except every 400
years. <p>

@param year The year to be tested. Make sure this is a four digit year!<p>

@return true if "year" is a leap year. <p>
*/
boolean isLeapYear( int year )
{
boolean y4 = ( ( year % 4 ) == 0 ) ;
boolean y100 = ( ( year % 100 ) == 0 ) ;
boolean y400 = ( ( year % 400 ) == 0 ) ;
return ( y400 || ( y4 && ! y100 ) );
}

:

    /** determine if the given year is a leap year. <p>

The Gregorian calendar principal states that a leap year occurs
every fourth year, except every 100 years, except every 400
years. <p>

@param year The year to be tested. Make sure this is a four digit year! <p>
@return true if "year" is a leap year. <p>

*/
boolean isLeapYear( int year )
{
boolean returnVal = false ;
if ( ( year % 400 ) == 0 )
{
// this is definitely a leap year
returnVal = true ;
}
else if ( ( year % 4 ) == 0 )
{
// this is probably a leap year
if ( ( year % 100 ) == 0 )
{
// this is definitely not a leap year
// do nothing
}
else
{
// this is definitely a leap year
returnVal = true ;
}
}
return returnVal ;
}

¹⤴

觷ա

do..while

ٻ do..while

˵ؼ: ֡ҷҹҨҹӴѺ÷ӧҹҡŧҷ ͹ programmer зӤ㨡Ѻ loop Ҩҡ͹䢢ͧѹ͹ ͹ǹ¨зҹӺҡҡ ա駨ҡʺóǹ˭繵ͧ do..while ö⤴㹷ҧ

ҵͧա:

    boolean done = false ;
do
{
...
} while( ! done )

:

    boolean done = false ;
while ( ! done )
{
...
}

"return" 㹪ͧҧͧ method

"return" ١ҧǹ¢ͧ method ҹ

˵ؼ: "return" 㹪ǧҧͧ method ҡ㹡¡ method ǹ method ѹѧ繡úѧѺ programmer ͧѧšѺҧͧ͡ method ҡ˹觷ա

"continue"

"continue" ա

˵ؼ: ҹ "continue" ҡ㹡¡ method ǹ method ѹѧ繡úѧѺ programmer ͧѧšѺҧͧ͡ method ҡ˹觷ա

"break" ͡ҡ Switch Statement

"break" ö١ѺǺ switch statement ҹ

˵ؼ: "break" ¡㹡óբͧ switch statement зҡ㹡¡ method ǹ method ѹѧ繡úѧѺ programmer ͧѧšѺҧͧ͡ method ҡ˹觷ա

Compound Increment Decrement

º÷Ѵ᷹ increment decrement.

ҧ:


    foo( x++ ); // no!
foo( x ) ; // yes! x++ ;
y += 100 * x++ ; // no!
y += 100 * x ; // yes! x++ ;

á˹

˹Ѻõ͹ҧѹ

һСȵèҨѹ ѹռšз öͧ⤴

ҧ:


    int totalWide ;
    int firstWide = 20 ;
    int secondWide = 12 ;
    firstWide = doFoo( firstWide , secondWide );
    doBar( firstWide , secondWide );
    totalWide = firstWide + secondWide ;     //  wrong!
int firstWide = 20 ; int secondWide = 12 ; firstWide = doFoo( firstWide , secondWide ); doBar( firstWide , secondWide ); int totalWide = firstWide + secondWide ; // right!
int secondWide = 12 ;
int firstWide = doFoo( 20 , secondWide ); doBar( firstWide , secondWide ); int totalWide = firstWide + secondWide ; // even better!

͹䢡

class attributes private ¡ inner classes

 

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -


171.97.173.124 Դ #23 (ҡ IP: 171.97.173.124)
ҡҺ㹡¡վ͵ФѺ i-net clear report ѹ¹¡ѧ¤Ѻ
繨ԧ úǹ¹ФѺ
ҡس : top / title4627@gmail.com [2014-11-08 14:40:00]

115.84.117.193 Դ #35 (ҡ IP: 115.84.117.193)
ҡ繹ѡ
ҡس : somphone / somphonephonepadith@gmail.com [2015-09-06 12:02:27]
ͺ
´

 
 
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI)
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI) ´дѺ 4K
ŧ Mini DisplayPort to HDMI Adapter ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
µٿѧ Ъ Ѻ iPhone 7  7 Plus
µٿѧ Ъ Ѻ iPhone 7 7 Plus
ŧҡ USB-C Type  USB 3.1 Ѻ MacBook
ŧҡ USB-C Type USB 3.1 Ѻ MacBook
䢤ǧѺͧ Macbook Air/Pro
䢤ǧ Ѻͧ Macbook Air/Pro (300ҷ)
HDMI  3 ͡  1
HDMI 3 ͡ 1 (350ҷ)
Ի͹¹
¹¹ͷ
¹¹͹´
¹¹
¹¹ վʾ
¹¹
¹ҹԹء
¹¹Թ⿹
¹¹Ϊ ʤ
9M Blog ͧ͡ ¹ͧ
ԡ ҾѺԭ
OrmSin.com: ˹ѧͧҹ--չ (country crafts)
ѵҤɳ
 
Ǣͧ

õ駤 Edit Plus 㹡þѲҧҹ Java

ó֡ þѲ кͧش (Library Case Study) IBM WebSphere Studio

õԴҹ J2ME
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
ẺǨ
Freelance ѺѲ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

ʧǹԢԷ Ѵ͡ ӫ Ѵŧ ٻẺ Ѻ͹حҵѡɳѡ
Ţ¹ҳԪ硷͹ԡҡзǧҳԪ: 7100503002000
Copyright 2001 SourceCode.in.th