Karteikarten
Java test 1
Karten in diesem Stapel (21)
- 1class formatpublic class ClassName {
} - 2main methodpublic static void main(String[] args) {
}
this is needed as it provides a starting point for program(see if lecture says differently) - 3list of primative data typesint, double, String, boolean, char(think that's all we need but also, short, long and float)
- 4how to declare constantin class(not a method) public static dataType final VARIABLENAME
- 5convert 150 to binary10010110
- 6scopepart of a program where a particular variable is valid
- 7declare a variabledatatype variableName
- 8declare a methodpublic(can be private too but not worrying about now) static(optional technically but should always use for now) dataType(or void if no return) methodName(datatype param1, datatype param2, ...(parameters are optional))
- 9for loop and what does each part dofor (int i = 0; i < something; i++) {
i < something checks to see if should run like f statement, i++ increases i's value every time the for loop is run by one} - 10.indexOf(whatYouAreLookingFor)gives the index value of where what is enclosed in brackets(if not there gives -1)
- 11string.substring(index1, index2) & string.substring(index1)creates a new string with index1 up to but not including index2
i.e. string = hello
string.substring(2,4) = ll
string.substring(1) = ello gives everything after and including first index - 12return statementwill give what the method when called will equal
i.e. method(int x) {
return x + 5;
}
so method(5) = 10 - 13how to print to consoleSystem.out.println();
System.out.print();(if you don't wanna make new line) - 14compound operators (see if she calls things like this or not)*=, -=, /=, etc.
- 15access virtuallyssh into remote.eos.ncsu.edu(a few others as well)
- 16afsAndrew File System ncsu's file system that contains course files, as well as can hold your files
course: afs/eos.ncsu.edu/courses/csc116
mine: afs/unity.ncsu.edu/users/j/jsipple - 17run filejava fileName.java
- 18compile filejavac -d bin(so that .class goes into bin) src(as you should be one up so .class goes into correct bin)/fileName.java
- 19procedural decompositionuse methods to stop redundancy of code, making problems into smaller "sub" problems
- 20parametervalue passed into a function, allows reuse of function giving different outputs based on information provided to the function
- 21returnexits method(nothing below runs) and returns a value for the method(i.e. method call now has a value)
Informationen
- Beschreibung
- Karteikarten am Java test 1, erstellt von Jacob Sipple am 23/01/2020.
- Erstellt von
- Jacob Sipple
- Aufrufe
- 46
- Bewertung