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
package edu.duke; | |
import java.io.File; | |
import javax.swing.JFileChooser; | |
import javax.swing.JOptionPane; | |
import javax.swing.SwingUtilities; | |
import javax.swing.filechooser.FileFilter; | |
/** |
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
void main(){ | |
var list = [10, "what", 4, 99]; | |
var list2 = <Object>[10, "what", 4, 99]; | |
print(list[1]); | |
//print(list.runtimeType); //error in dartPad | |
print(list.length); | |
for(int i = 0; i<list.length; i++){ | |
print("Index $i contains ${list[i]}"); | |
} | |
print(list2.runtimeType); |
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
//dart does not do interfaces, but rather all classes | |
//seem to be able to be implemented | |
abstract class IsFerocious { | |
void intimidate(); | |
String whatTheFearfulSay(); | |
} | |
class Animal{ | |
String name; | |
String lastName; |
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
void main(){ | |
var num = 34; | |
var age = 18; | |
var nameTracker; | |
do { | |
print("going..."); | |
num++; | |
}while(num <38); | |
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
void main(){ | |
var num = 47; | |
//is and is! | |
print(num is String); | |
print(num is! bool); | |
print(num is int); | |
//If statement | |
if(num is! int){ |
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
void main() { | |
var result = 4 / 2; | |
print(result); | |
print(result.runtimeType); | |
var result2 = 4.0 / 2.0; | |
print(result2); | |
print(result2.runtimeType); |
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
void main() { | |
String name = "James"; | |
String lastName = "Bond"; | |
int age = 45; | |
print('his name is ${name + ' ' + lastName} he is $age years old'); | |
print('his name is $name $lastName he is $age years old'); | |
print('${lastName.toUpperCase()}'); | |
bool isTheBest = false; |
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
void main() { | |
//each of these must be initialized and can't be changed | |
const pi = 3.14; | |
final pi2 = 3.14; | |
//final collections may be mutable, const collections immutable | |
const immutableList = [2,3,4,5,6]; | |
//get 'unsupported operation: add' exception |
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
void main(){ | |
var country = 'United States'; | |
String name; | |
var dynamo; | |
var preType = dynamo.runtimeType; | |
print(preType); | |
//print(name is dynamic); | |
//looks like everything is dynamic?!? | |
dynamo = 47; |