Views
7 months ago

java_tutorial

  • Page 2 and 3: Java About the Tutorial Java is a h
  • Page 4 and 5: Java 5. Java - Basic Datatypes ....
  • Page 6 and 7: Java Java - String Buffer delete()
  • Page 8 and 9: Java File Class ...................
  • Page 10 and 11: Java The Dictionary Class .........
  • Page 12 and 13: Java - Basics
  • Page 14 and 15: Java Distributed: Java is designe
  • Page 16 and 17: 2. Java - Environment Setup Java In
  • Page 18 and 19: 3. Java - Basic Syntax Java When we
  • Page 20 and 21: Java Java Identifiers All Java comp
  • Page 22 and 23: Java class const continue default d
  • Page 24 and 25: 4. Java - Objects & Classes Java Ja
  • Page 26 and 27: Java Each time a new object is crea
  • Page 28 and 29: Java This will produce the followin
  • Page 30 and 31: Java Example This example explains
  • Page 32 and 33: Java Import Statements In Java if a
  • Page 34 and 35: Java Now, compile both the classes
  • Page 36 and 37: Java Example: short s = 10000, sho
  • Page 38 and 39: Java Prefix 0 is used to indicate o
  • Page 40 and 41: 6. Java - Variable Types Java A var
  • Page 42 and 43: Java This will produce the followin
  • Page 44 and 45: Java This will produce the followin
  • Page 46 and 47: 7. Java - Modifier Types Java Modif
  • Page 48 and 49: Java Protected Access Modifier - Pr
  • Page 50 and 51: Java private static void addInstanc
  • Page 52 and 53:

    Java The Abstract Modifier Abstract

  • Page 54 and 55:

    Java Example public class MyRunnabl

  • Page 56 and 57:

    8. Java - Basic Operators Java Java

  • Page 58 and 59:

    Java // Check the difference in d++

  • Page 60 and 61:

    Java This will produce the followin

  • Page 62 and 63:

    Java Example The following program

  • Page 64 and 65:

    Java Example The following simple e

  • Page 66 and 67:

    Java 9 &= Bitwise AND assignment op

  • Page 68 and 69:

    Java c /= a = 1 c %= a = 5 c = 2 =

  • Page 70 and 71:

    Java Precedence of Java Operators O

  • Page 72 and 73:

    Java While Loop in Java A while loo

  • Page 74 and 75:

    Java Syntax The syntax of a for loo

  • Page 76 and 77:

    Java } This will produce the follow

  • Page 78 and 79:

    Java This will produce the followin

  • Page 80 and 81:

    Java This will produce the followin

  • Page 82 and 83:

    Java Expression: This evaluates to

  • Page 84 and 85:

    Java nested if statements You can u

  • Page 86 and 87:

    Java Flow Diagram Example public cl

  • Page 88 and 89:

    Java } } This will produce the foll

  • Page 90 and 91:

    Java A switch statement can have a

  • Page 92 and 93:

    Java What is Next? In the next chap

  • Page 94 and 95:

    Java This will produce the followin

  • Page 96 and 97:

    Java 17 sqrt() Returns the square r

  • Page 98 and 99:

    Java // Returns double primitive da

  • Page 100 and 101:

    Java Example public class Test{ pub

  • Page 102 and 103:

    Java Java - toString() Method Descr

  • Page 104 and 105:

    Java This will produce the followin

  • Page 106 and 107:

    Java } } System.out.println(Math.fl

  • Page 108 and 109:

    Java } } System.out.println(Math.ri

  • Page 110 and 111:

    Java Return Value This method retu

  • Page 112 and 113:

    Java Example public class Test{ pub

  • Page 114 and 115:

    Java Example public class Test{ pub

  • Page 116 and 117:

    Java Example public class Test{ pub

  • Page 118 and 119:

    Java Example public class Test{ pub

  • Page 120 and 121:

    Java Example public class Test{ pub

  • Page 122 and 123:

    Java Example public class Test{ pub

  • Page 124 and 125:

    Java Example public class Test{ pub

  • Page 126 and 127:

    12. Java - Character Class Java Nor

  • Page 128 and 129:

    Java Character Methods Following is

  • Page 130 and 131:

    Java Example public class Test { }

  • Page 132 and 133:

    Java Example public class Test{ } p

  • Page 134 and 135:

    Java Example public class Test{ } p

  • Page 136 and 137:

    Java Example public class Test{ } p

  • Page 138 and 139:

    Java The StringBuilder class was in

  • Page 140 and 141:

    Java Example public class Test { }

  • Page 142 and 143:

    Java Example public class Test { }

  • Page 144 and 145:

    Java Parameters Here is the detail

  • Page 146 and 147:

    Java 11 void setLength(int newLengt

  • Page 148 and 149:

    Java Using String's static format()

  • Page 150 and 151:

    Java 15 int hashCode() Returns a ha

  • Page 152 and 153:

    Java 35 boolean startsWith(String p

  • Page 154 and 155:

    Java Java - String compareTo(Object

  • Page 156 and 157:

    Java } } result = str3.compareTo( s

  • Page 158 and 159:

    Java Example public class Test { }

  • Page 160 and 161:

    Java Example public class Test { pu

  • Page 162 and 163:

    Java Example public class Test{ pub

  • Page 164 and 165:

    Java Parameters Here is the detail

  • Page 166 and 167:

    Java This will produce the followin

  • Page 168 and 169:

    Java } } }catch( Exception ex){ } S

  • Page 170 and 171:

    Java Example import java.io.*; publ

  • Page 172 and 173:

    Java Example import java.io.*; publ

  • Page 174 and 175:

    Java Example import java.io.*; publ

  • Page 176 and 177:

    Java fromIndex -- the index to sta

  • Page 178 and 179:

    Java Example import java.io.*; publ

  • Page 180 and 181:

    Java Return Value Example This met

  • Page 182 and 183:

    Java System.out.println(Str1.region

  • Page 184 and 185:

    Java Java - String replace() Method

  • Page 186 and 187:

    Java Java - String replaceFirst() M

  • Page 188 and 189:

    Java } } System.out.println(retval)

  • Page 190 and 191:

    Java } } System.out.println(retval)

  • Page 192 and 193:

    Java } } System.out.println(Str.sta

  • Page 194 and 195:

    Java Example import java.io.*; publ

  • Page 196 and 197:

    Java Syntax Here is the syntax of t

  • Page 198 and 199:

    Java Java - String toLowerCase() Me

  • Page 200 and 201:

    Java Java - String toString() Metho

  • Page 202 and 203:

    Java Syntax Here is the syntax of t

  • Page 204 and 205:

    Java valueOf(char[] data, int

  • Page 206 and 207:

    Java This will produce the followin

  • Page 208 and 209:

    Java The above statement does two t

  • Page 210 and 211:

    Java The foreach Loops JDK 1.5 intr

  • Page 212 and 213:

    Java public static void fill(int[]

  • Page 214 and 215:

    Java 5 int compareTo(Object obj) Op

  • Page 216 and 217:

    Java Simple DateFormat Format Codes

  • Page 218 and 219:

    Java } } // display time and date u

  • Page 220 and 221:

    Java I Two-digit hour (with leading

  • Page 222 and 223:

    Java } } } catch (Exception e) { }

  • Page 224 and 225:

    Java 5 GregorianCalendar(Locale aLo

  • Page 226 and 227:

    Java void roll(int field, boolean u

  • Page 228 and 229:

    Java This will produce the followin

  • Page 230 and 231:

    Java Example Following example illu

  • Page 232 and 233:

    Java re? Matches 0 or 1 occurrence

  • Page 234 and 235:

    Java Methods of the Matcher Class H

  • Page 236 and 237:

    Java The start and end Methods Foll

  • Page 238 and 239:

    Java } } System.out.println("lookin

  • Page 240 and 241:

    Java PatternSyntaxException Class M

  • Page 242 and 243:

    Java Parameter List: The list of

  • Page 244 and 245:

    Java Example public class ExampleVo

  • Page 246 and 247:

    Java This will produce the followin

  • Page 248 and 249:

    Java Example The following program

  • Page 250 and 251:

    Java } } You will need to call a co

  • Page 252 and 253:

    Java this(); } //Assigning the loca

  • Page 254 and 255:

    Java } } System.out.println("The ma

  • Page 256 and 257:

    Java out = new FileOutputStream("ou

  • Page 258 and 259:

    Java Standard Streams All the progr

  • Page 260 and 261:

    Java The two important streams are

  • Page 262 and 263:

    Java This method reads upto len num

  • Page 264 and 265:

    Java DataInputStream The DataInputS

  • Page 266 and 267:

    Java FileOutputStream FileOutputStr

  • Page 268 and 269:

    Java public String toString() 3 Con

  • Page 270 and 271:

    Java DataOutputStream The DataOutpu

  • Page 272 and 273:

    Java Example Following is the examp

  • Page 274 and 275:

    Java 3 public File getParentFile()

  • Page 276 and 277:

    Java 18 public String[] list(Filena

  • Page 278 and 279:

    Java Example Following is an exampl

  • Page 280 and 281:

    Java Example Following is an exampl

  • Page 282 and 283:

    Java Writes a portion of an array o

  • Page 284 and 285:

    Java Listing Directories You can us

  • Page 286 and 287:

    Java If you try to compile the abov

  • Page 288 and 289:

    Java IllegalMonitorStateException I

  • Page 290 and 291:

    Java Catching Exceptions A method c

  • Page 292 and 293:

    Java return -1; }catch(FileNotFound

  • Page 294 and 295:

    Java Example public class ExcepTest

  • Page 296 and 297:

    Java try(FileReader fr=new FileRead

  • Page 298 and 299:

    Java To demonstrate using our user-

  • Page 300 and 301:

    Java Sorry, but you are short $200.

  • Page 302 and 303:

    Java Inner Classes (Non-static Nest

  • Page 304 and 305:

    Java } } Outer_Demo.Inner_Demo inne

  • Page 306 and 307:

    Java Anonymous Inner Class as Argum

  • Page 308 and 309:

    Java 297

  • Page 310 and 311:

    Java Java - Object Oriented 299

  • Page 312 and 313:

    Java Copy and paste the following p

  • Page 314 and 315:

    Java Differentiating the Members If

  • Page 316 and 317:

    Java Invoking Superclass Constructo

  • Page 318 and 319:

    Java Now, if we consider the IS-A r

  • Page 320 and 321:

    Java This will produce the followin

  • Page 322 and 323:

    22. Java - Overriding Java In the p

  • Page 324 and 325:

    Java } } b.bark(); This will produc

  • Page 326 and 327:

    23. Java - Polymorphism Java Polymo

  • Page 328 and 329:

    Java } public void setAddress(Strin

  • Page 330 and 331:

    Java mailCheck() on e is quite diff

  • Page 332 and 333:

    Java { System.out.println("Construc

  • Page 334 and 335:

    Java Inheriting the Abstract Class

  • Page 336 and 337:

    Java You have to place the abstr

  • Page 338 and 339:

    Java public void setAge( int newAge

  • Page 340 and 341:

    26. Java - Interfaces Java An inter

  • Page 342 and 343:

    Java A class uses the implements ke

  • Page 344 and 345:

    Java The Hockey interface has four

  • Page 346 and 347:

    Java Following package example cont

  • Page 348 and 349:

    Java What happens if the Employee c

  • Page 350 and 351:

    Java Like the .java source files, t

  • Page 352 and 353:

    28. Java - Data Structures Java The

  • Page 354 and 355:

    Java This will produce the followin

  • Page 356 and 357:

    Java 10 void flip(int startIndex, i

  • Page 358 and 359:

    Java // set some bits for(int i=0;

  • Page 360 and 361:

    Java This constructor accepts an ar

  • Page 362 and 363:

    Java 17 Object get(int index) Retur

  • Page 364 and 365:

    Java 36 void setSize(int newSize) S

  • Page 366 and 367:

    Java This will produce the followin

  • Page 368 and 369:

    Java static void showpop(Stack st)

  • Page 370 and 371:

    Java boolean isEmpty( ) 3 Returns t

  • Page 372 and 373:

    Java Object put(Object k, Object v)

  • Page 374 and 375:

    Java Hashtable(int size, float fill

  • Page 376 and 377:

    Java Example The following program

  • Page 378 and 379:

    Java Apart from the methods defined

  • Page 380 and 381:

    Java This will produce the followin

  • Page 382 and 383:

    Java The Collection Interfaces The

  • Page 384 and 385:

    Java boolean equals(Object obj) 6 7

  • Page 386 and 387:

    Java } } //HashMap Map m1 = new Has

  • Page 388 and 389:

    Java Example The above interface ha

  • Page 390 and 391:

    Java Example Set has its implementa

  • Page 392 and 393:

    Java Example SortedSet have its imp

  • Page 394 and 395:

    Java 7 8 int hashCode( ) Returns th

  • Page 396 and 397:

    Java Example Following is an exampl

  • Page 398 and 399:

    Java Example SortedMap has its impl

  • Page 400 and 401:

    Java } } Vector dayNames = new Vect

  • Page 402 and 403:

    Java 10 AbstractMap Implements most

  • Page 404 and 405:

    Java Object get(int index) 10 Retur

  • Page 406 and 407:

    Java // remove elements from the li

  • Page 408 and 409:

    Java 6 Object clone() Returns a sha

  • Page 410 and 411:

    Java } } // display the array list

  • Page 412 and 413:

    Java 5 6 7 8 boolean isEmpty() Retu

  • Page 414 and 415:

    Java LinkedHashSet hs = new LinkedH

  • Page 416 and 417:

    Java 11 12 13 Object last() Returns

  • Page 418 and 419:

    Java 3 4 5 boolean containsKey(Obje

  • Page 420 and 421:

    Java This will produce the followin

  • Page 422 and 423:

    Java 14 15 Object remove(Object key

  • Page 424 and 425:

    Java Following is the list of const

  • Page 426 and 427:

    Java } }; Thread t = new Thread(run

  • Page 428 and 429:

    Java // Put elements to the map lhm

  • Page 430 and 431:

    Java Apart from the methods inherit

  • Page 432 and 433:

    Java } } } System.out.println(); //

  • Page 434 and 435:

    Java 4 Vector(Collection c) Creates

  • Page 436 and 437:

    Java 24 int lastIndexOf(Object elem

  • Page 438 and 439:

    Java v.addElement(new Integer(4));

  • Page 440 and 441:

    Java Example The following program

  • Page 442 and 443:

    Java 4 Enumeration keys( ) Returns

  • Page 444 and 445:

    Java 13 int size( ) Returns the num

  • Page 446 and 447:

    Java boolean containsKey(Object key

  • Page 448 and 449:

    Java This will produce the followin

  • Page 450 and 451:

    Java Set states; String str; capita

  • Page 452 and 453:

    Java boolean equals(Object bitSet)

  • Page 454 and 455:

    Java System.out.println("Initial pa

  • Page 456 and 457:

    Java 5 static void fill(List list,

  • Page 458 and 459:

    Java 30 31 32 33 34 35 36 37 static

  • Page 460 and 461:

    Java How to Use an Iterator ? Often

  • Page 462 and 463:

    Java int previousIndex( ) 7 Returns

  • Page 464 and 465:

    Java This will produce the followin

  • Page 466 and 467:

    Java public class Example{ public s

  • Page 468 and 469:

    Java Example Following example illu

  • Page 470 and 471:

    Java return max; // returns the lar

  • Page 472 and 473:

    31. Java - Serialization Java Java

  • Page 474 and 475:

    Java } } System.out.printf("Seriali

  • Page 476 and 477:

    32. Java - Networking Java The term

  • Page 478 and 479:

    Java Returns the port of the URL. 5

  • Page 480 and 481:

    Java URLConnections Class Methods T

  • Page 482 and 483:

    Java } { } try { URL url = new URL(

  • Page 484 and 485:

    Java ServerSocket Class Methods The

  • Page 486 and 487:

    Java public Socket() 5 Creates an u

  • Page 488 and 489:

    Java { String serverName = args[0];

  • Page 490 and 491:

    Java } { System.out.println("Socket

  • Page 492 and 493:

    Java // Get system properties Prope

  • Page 494 and 495:

    Java // Assuming you are sending em

  • Page 496 and 497:

    Java try{ // Create a default MimeM

  • Page 498 and 499:

    34. Java - Multithreading Java Java

  • Page 500 and 501:

    Java void start( ); Example Here is

  • Page 502 and 503:

    Java Step 1 You will need to overri

  • Page 504 and 505:

    Java Thread: Thread-2, 2 Thread: Th

  • Page 506 and 507:

    Java Example The following ThreadCl

  • Page 508 and 509:

    Java System.out.println("Starting t

  • Page 510 and 511:

    Java Multithreading Example without

  • Page 512 and 513:

    Java Counter --- 3 Counter --- 2 Co

  • Page 514 and 515:

    Java This produces the same result

  • Page 516 and 517:

    Java public T1(Chat m1) { this.m =

  • Page 518 and 519:

    Java } synchronized (Lock2) { Syste

  • Page 520 and 521:

    Java } } } } synchronized (Lock2) {

  • Page 522 and 523:

    Java } } catch (InterruptedExceptio

  • Page 524 and 525:

    Java Thread: Thread-2, 7 Suspending

  • Page 526 and 527:

    Java destroy: This method is only

  • Page 528 and 529:

    Java Example HTML applet Tag

  • Page 530 and 531:

    Java Not valid in base, br, frame,

  • Page 532 and 533:

    Java onresize onstorage onundo onun

  • Page 534 and 535:

    Java Media Events Following tags ha

  • Page 536 and 537:

    Java Getting Applet Parameters The

  • Page 538 and 539:

    Java Following are the specific ste

  • Page 540 and 541:

    Java public void mouseExited(MouseE

  • Page 542 and 543:

    Java Playing Audio An applet can pl

  • Page 544 and 545:

    36. Java - Documentation Comments J

  • Page 546 and 547:

    Java @exception Adds a Throws subhe

  • Page 548 and 549:

    Java /** * This is the main method

Swing attempts to make simple things easy and difficult things ...
Beginning Android Games.pdf - ftp
No Fluff Just Stuff 2007 - Bosatsu Consulting
Program Development: The Fun of Writing Java ... - schmiedecke.info
Creating Custom JSP Tag Libraries - Custom Training Courses ...
TEAMFLY