Reorganize repository
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class ByteOverFlow {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
byte b = 127;
|
||||
b++;
|
||||
System.out.println(b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class LogicalExpression {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int x = -10;
|
||||
boolean hasCycled = false;
|
||||
while (true) {
|
||||
//System.out.print(((x > 1) || ( x < 100) ) && (x < 0)); //incorrect
|
||||
System.out.print("Logical Expression result: ");
|
||||
System.out.print(x < 100 && x > 1 || (x < 0)); //correct
|
||||
System.out.print(": " + x);
|
||||
|
||||
if (x >= 150 & hasCycled == false) {
|
||||
hasCycled = true;
|
||||
} else if (x <= -10) {
|
||||
hasCycled = false;
|
||||
}
|
||||
|
||||
if (hasCycled) {
|
||||
System.out.println(" state: currently subtracting 1");
|
||||
x--;
|
||||
} else {
|
||||
System.out.println(" state: currently adding 1");
|
||||
x++;
|
||||
}
|
||||
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(250); //waits for a specified amount of time
|
||||
} catch (Exception e) {
|
||||
System.out.print("lol");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class LulyBoolean {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
boolean even = false;
|
||||
System.out.println((even ? true : false));
|
||||
System.out.println(even);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Mavenproject1 {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int x = 10;
|
||||
int y = 1;
|
||||
|
||||
System.out.println(x ^ y); // result is 11
|
||||
System.out.println(x & y); //result is 0
|
||||
System.out.println(x | y); // result is 11
|
||||
System.out.println(0 ^ 1); // result is 1
|
||||
System.out.println(1 ^ 1); // result is 0
|
||||
System.out.println(0 ^ 0); // result is 11 (Wrong Markou, Wrong)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class NotDemo {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(!true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class PrePostIncrement {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int j = 2;
|
||||
int i = j++ + j * j + 1;
|
||||
|
||||
System.out.println("i is: " + i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class TypeCasting {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
double b = 5.3;
|
||||
int c = (int) b;
|
||||
double d = ((double) 1 / 2);
|
||||
|
||||
System.out.println(b);
|
||||
System.out.println(c);
|
||||
System.out.println(d);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user