You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The comparison operator for numbers are the same as in Python. For built-in types, instead of == in Python, Java uses equals method.  

Python's Boolean operators: and, or, and not are replaced by: &&, || and ! in Java

Negation is also formed differently between those two programming languages

 

Negation in Java
 
Negation in Python
x is not y

 



Strings in Java
int    myCounter = 0;
String myString = String.valueOf(myCounter);
if (myString.equals("0")) ...
Strings in Python
myCounter = 0
myString = str(myCounter)
if myString == "0": ...



  • No labels