Javadoc Puzzlers of the Day - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Javadoc Puzzlers of the Day

Description:

public static int abs(int a) Returns the absolute value of an int value. ... Integer.MIN_VALUE, the most negative representable int value, the result is that ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 18
Provided by: jsolu
Category:

less

Transcript and Presenter's Notes

Title: Javadoc Puzzlers of the Day


1
Java(doc) Puzzlersof the Day
  • Roger Lindsjö, Ericsson

Tack till Joshua Bloch, Neil Gafter
2
Perfekt Hash
3
Vad blir utskriften?
4
(No Transcript)
5
Hmm
Kan returnera negativa svar
6
Math.abs
7
Vad blir utskriften?
8
(No Transcript)
9
Math.abs Javadoc
  • public static int abs(int a) Returns the absolute
    value of an int value.
  • If the argument is not negative, the argument is
    returned. If the argument is negative, the
    negation of the argument is returned.
  • Note that if the argument is equal to the value
    of Integer.MIN_VALUE, the most negative
    representable int value, the result is that same
    value, which is negative.

10
Väl valda värden
läsa.hashCode() installeras.hashCode()
Integer.MIN_VALUE
11
Unika URLer
12
Vad blir utskriften?
13
Alla rätt
14
URL.equals Javadoc
  • Two hosts are considered equivalent if both host
    names can be resolved into the same IP addresses
    else if either host name can't be resolved, the
    host names must be equal without regard to case
    or both host names equal to null.
  • Since hosts comparison requires name resolution,
    this operation is a blocking operation.
  • Note The defined behavior for equals is known to
    be inconsistent with virtual hosting in HTTP.

15
(No Transcript)
16
Sensmoralen
  • Läs Javadoc innan du använder metoden första
    gången. Den kanske inte gör vad du tror.
  • Testa gränsvärden.

17
Manage name resolving
  • http//java.sun.com/javase/6/docs/technotes/guides
    /net/properties.html
  • Codejava.security.Security.setProperty("networkad
    dress.cache.ttl" , "0")
  • Commandline-Dsun.net.inetaddr.ttl0
Write a Comment
User Comments (0)
About PowerShow.com