This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForLoops { | |
public static void main(String[] args) { | |
// for ( init ; test ; increment ) { | |
// body | |
// } | |
// 1) The 'init' code runs once to set things up at the very start of the loop. | |
// 2) The boolean 'test' is evaluated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Expressions { | |
public static void main(String[] args) { | |
// Expressions evaluate to a value... | |
int z = 1 + 1; | |
// ^^^^^ | |
// Statements do not. | |
System.out.println("This is a statement."); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean a = false; | |
boolean b = true; | |
// Example 1 | |
if(b); | |
a = true; | |
System.out.println(a) | |
// Example 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() { | |
//long x = 1; | |
long x = -1; | |
// A pointer to the bit pattern, interpreted as a 32-bit signed int | |
int* i = (int*) &x; |
NewerOlder