This file contains 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 Test { | |
public static void main(String... args) { | |
double i = 1.0d; | |
double d; | |
while (true) { | |
d = i / 2; | |
if (d * 2 != i) | |
throw new RuntimeException(d + " * 2 != " + i); | |
i = d; | |
} |
This file contains 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
package jfxsbox; | |
import javafx.event.EventHandler; | |
import javafx.application.Application; | |
import javafx.geometry.Pos; | |
import javafx.scene.Scene; | |
import javafx.scene.layout.StackPane; | |
import javafx.scene.layout.Pane; | |
import javafx.stage.Stage; | |
import javafx.scene.Node; |
This file contains 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
package jfxsbox; | |
import javafx.application.Application; | |
import javafx.geometry.Pos; | |
import javafx.scene.Scene; | |
import javafx.scene.layout.StackPane; | |
import javafx.scene.layout.Pane; | |
import javafx.stage.Stage; | |
public class Main extends Application { |
This file contains 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
fn longer<'a>(s0: &'a str, s1: &'a str) -> &'a str { | |
if s0.len() > s1.len() { | |
s0 | |
} else { | |
s1 | |
} | |
} | |
fn main() { | |
let s0 = "Hi"; |
This file contains 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
fn longer(s0: &str, s1: &str) -> &str { | |
if s0.len() > s1.len() { | |
s0 | |
} else { | |
s1 | |
} | |
} | |
fn main() { | |
let s0 = "Hi"; |
This file contains 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
fn longer(s0: &String, s1: &String) -> String { | |
if s0.len() > s1.len() { | |
s0.to_string() | |
} else { | |
s1.to_string() | |
} | |
} | |
fn main() { | |
let s0 = "Hi"; |
This file contains 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
use std::fmt; | |
#[derive(Debug)] | |
struct Point { | |
x: i32, | |
y: i32, | |
} | |
impl fmt::Display for Point { | |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
This file contains 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
#[derive(Debug)] | |
struct Point { | |
x: i32, | |
y: i32, | |
} | |
fn main() { | |
let p = Point {x: 1, y: 2}; | |
println!("p: {:?}", p); | |
println!("p: {:#?}", p); |
This file contains 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
#[derive(Copy, Clone)] | |
struct Point { | |
x: i32, | |
y: i32, | |
} | |
fn main() { | |
let p0 = Point {x: 1, y: 2}; | |
let p1 = p0; | |
println!("point: {}, {}", p0.x, p0.y); |
This file contains 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
struct Point { | |
x: i32, | |
y: i32, | |
} | |
fn main() { | |
let p = Point {x: 1, y: 2}; | |
println!("point: {}, {}", p.x, p.y); | |
} |
NewerOlder