Skip to content

Instantly share code, notes, and snippets.

View 22raor's full-sized avatar
💭
who knows

Rishi Rao 22raor

💭
who knows
View GitHub Profile
@22raor
22raor / CommandExample.java
Created June 29, 2020 07:06
Execute method
public void execute() {
RobotContainer.yourSub.printMethod();
//We have to access your subsystem object, stored in RobotContainer
//We then call the method you created on that object
}
@22raor
22raor / Initialization.java
Last active June 29, 2020 17:51
Subsystem and Command Initialization
public final YourSubsystem yourSub = new YourSubsystem();
//make sure to also import the YourSubsystem class.
@22raor
22raor / MethodChallenge1.java
Created June 29, 2020 04:16
MethodChallenge1
public class MethodChallenge1 {
public static void main(String...args) {
System.out.println( greater(1,2) );
}
public static int greater(int a, int b) {
if(a>b) {
return a;
} else{
@22raor
22raor / MutabilityDemo.java
Created June 28, 2020 23:24
Demo Of Mutability
import java.awt.Point; //Here we import the Point class
public class MutabilityDemo {
public static void main(String...args) {
Point p = new Point(1,1); //We use the Point constructor (using the new keyword) to create a Point object
Point p2 = p; //We set a second point equal to the first.
p.setLocation(2,2);
/* When we put a period next to an object, we are calling a method (in this case setLocation) on that object.
The method is part of the Point class
@22raor
22raor / HelloWorld.java
Created June 28, 2020 20:41
DataTypes Example 1
public class HelloWorld {
public static void main(String[] args) {
String msg = "Hello World!"; //We initialize the variable here to "Hello World!"
System.out.println(msg); //To use the value from the variable, we simply use the variable name, msg
}
}