Decimal to binary
number / 2 = end number + quotient
do this until the number is gone, making a chart
x/2 = Number Remainder
repeat until you get a decimal
at this point, the number you have before dividing is the bit
Then reverse the remainders to get your binary
1/69
Term | Definition |
---|---|
Decimal to binary | number / 2 = end number + quotient do this until the number is gone, making a chart x/2 = Number Remainder repeat until you get a decimal at this point, the number you have before dividing is the bit Then reverse the remainders to get your binary |
Decimal to hex | number / 16 = end number + quotient do this until the number is gone, making a chart x/16 = Number Remainder repeat until you get a decimal at this point, the number you have before dividing is the bit Then reverse the remainders to get your hex |
Decimal to oct | number / 8 = end number + quotient do this until the number is gone, making a chart x/8 = Number Remainder repeat until you get a decimal at this point, the number you have before dividing is the bit Then reverse the remainders to get your oct |
Decimal form | Just write it like normal |
Binary form | 1's and 0's, sometimes with a 1. or 0. in front for pos/neg |
Hex form | 0x(the code) |
Oct form | 0(the code) |
Hex to decimal | number x 16^ its place .... number x 16^0 |
Binary to decimal | number x 2^ its place .... number x 2^0 |
Oct to decimal | number x 8^ its place .... number x 8^0 |
Hex to binary | Each hex bit becomes a 4bit piece of binary |
Hex to oct | Each hex bit becomes a 4bit piece of binary, then that becomes 3bit pieces, which we then turn into oct. |
Binary to hex | Section binary into 4's, then turn each 4 into a hex |
Oct to hex | Convert into binary, then section binary into 4's, then turn each 4 into a hex |
binary to oct | Binary into sections of 3, then convert into hard numbers |
oct to binary | Each oct bit becomes a 3bit binary |
The color gray is created by using the same value for r, g, and b. How many shades of gray are there? Why | 255, because r, g, and b are 2bit hex, so max value is 255 |
The process of compiling a file | Make a file Name.java Then make sure the file name and class are the same Then in command type javac Name.java It will compile into Name.class Then to run we type in command run Name |
=, +=, −=, *=, /=, %= <- What do these symbols mean? | = applies the right value to the right var += is left eqls left + value -= is left eqls left - value *= is left eqls left * value /= is left eqls left / value %= is left eqls left % value |
Rules for a Java file / class name | Must be the same, must use uppercase for each word |
Rules for identifier / var / object / method | camel case |
Rules for legit all naming | Must start with a valid Java letter Can have # just not at the start No spaces Case Sensitive No keywords, reserved words, or getting too close to them |
Types of data and what they are used for (in order) | byte, short, int, long, float, double, char, boolean |128|, |32k|, |2bil|, |9 gazillion|, small x.yz 4 byte, big x.yz 8byte, one character two bytes, true or false |
Difference between x / y and x.0 / y | using ints will give you an int esc result even if the end result will be shown as a double. Instead, is one of the numbers is a double (.0) the math will be done assuming doubles are in play, and you will get a more precise number. |
What do () do to the flow of operations? | Instead of going left to right, you can change order to left to right, this affects casting. |
Rules for Constant | All caps and _ for spaces put final before the dataType |
How to type floats and longs? | end with the letter caps, ie 3.2F and 12L |
, $ and % are | not literals, they are for computers |
Char and Strings need what | '' and "" |
DataTypes can be declared how many times | Once |
Strings are | lines of text that are treated as both class and data type |
concatenation | ie the combining of strings and vars to print |
How many lines can a string be? | Only one, any more and you have to use concatenation |
\n, \t, \b, \', \", \\, \r, \f | newline, tab, backspace, quote, quotes, \, carrage return, form feed, all meant for the inside of strings |
What is a package | A group of Java classes premade that can be imported |
Methods can access/change what | the instance variables within that class |
Classes protect data how | only methods can change the fields so classes end up as a layer of protection for any data |
Benefits of classes | reliability, encapsulation, reusability |
User imput can come from three places | keyboard, file, user interface |
What does System.in do? What is it? | Means your Scanner will look at keyboard inputs. It is an input stream |
What java package comes free with your xbox <- reference, not actual console based question | java.lang |
System - tell me | System is a java.lang class it has static constant fields: in, out, exit In = keyboard out = java console exit = terminate program here, not at end of program |
print and println - tell me bro | PrintStream take arguemtns of primitive data / string / object reference println prints a newline character right after the output |
number in da system exit, write it, tell me what mean | System.exit(num); 0 = normal terminate any other num = something wacky happen |
toString | a method of every class automatically used whenever an obj is used as a string converts an object into a printable string value toString is used auto when an obj. is used in a string API => String toString(); |
Class() <- blank arugment list means what | The constructor's default argument list will autofill there, whatever those values happen to be |
API keeps track of what | methods, classes, the types of data used in those methods, argument lists, etc |
what happens if you use a method to set an objects variable to an inavlid value | the method will not change the thing, ensuring valid values |
WHat happens if I chance an objects refference to match another object. What happens to the object with two references now? What about the one with no reference? | The reference moves to that other object, so now one object has two references, and the other has none. The one with two can now be reffered to multiple ways. The one with none is marked for garbage collection. |
Garbage Collector | releases memory of objects not referenced, dust in the wind now |
when do we get the value null | when an object references is declared but not assigned an object |
What happens when you run a method with a null reference | exception error |
public vs private | |
static vs not | method that can be called without needing an obj |
constructor overload | as long as the parimeters are diff, you can have multiple constructors of the same class, this is called overlaoding |
DecimalFormat - 0 # . , $ % <- What mean? | 0 = required digit - if no # given, will be a zero, will round up # = optional digit - if no # given, will be blank, will round up . = Decimal point ; = Comma separator $ = dollar sign % = multiplpy by 100, format, then and add percent sign |
Static classes can use what? Can't use what? | Cannot use obj data, can use class data |
Wrapper class | Turns a primitive dataType into an obj |
Can you call a method on a prim. dataType? | Nope, only objs |
runtime error | broken math rules |
compile error | broke java rules |
logic error | you fucked it up moron |
those assigning statements, how work | dataType varName = expression is the same thing as ClassName varName = new ClassName(); |
Can you cast onto varNames? | Yes |
Is the & symbol allowed in varNames? | No |
Classes to packages | Scanner -> .util Character -> .lang NumberFormat -> .text Math -> .lang (default) DecimalFormat -> .text |
You can string methods together maybe sometimes? | scan.next().charAt(number); |
binary opperations | meaning they compare two vars, has nothing to do with binary 010011, binary as in two broski |
! and || require both statements be | boolean |