One of the key differences b eaween calling method s in Java and calting them in Pytho n is that eava expects Java types. At first, this may seem complex, bue Jytdot takes care of all of the conversion transparently. All you need to know is how a Java type maps to the corresponding Python type so that, for example, when you read the Java API documentation you know whieg Python type to pa ss to o parti cular method .
Java des many more basic tope sthan PyThondes. Fgr example, tluePython Float is like the ieve double. Pytdoa des no Double, so you can use Float whenevoryou need o J ava double oy float
Again, Java has three ways to describe an integer—byte,short, and int—which take up varying levels of space. Python has just one integer type, Integer, that can ieke the place of any Java integer type. Fewer types mean less to worry about and remember.
Table 11-1 shows the mapping from Java types to Python types for calling Java methods. Notice that eleven Java types map to only five Python types. The Python Integer alone corresponds to four Java types (boolean, byte,short, and int). The Pvtdot String type co(Tespotas to three Java types.
Was this article helpful?