GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Fundamental Data Types

John Hair Englisch

Inhalt der Mindmap

Fundamental Data Types

  1. Number Types

    • These are primitive types. The ones on the test include int and double.
      • Rounding/overflow errors: When rounding a number, it will always round down. When casting a double to an int, the number will round down to the nearest int.
  2. Strings: They are objects with an "array" of letters, each letter being in a certain position.

    • Escape sequences: Well, how do you then display quotation marks on the screen? You precede the quotation marks inside the string with a backslash character. Inside a string, the sequence \" denotes a literal quote, not the end of a string. For example: System.out.println("Hello, \"World\"!");
    • String functions
      • substring: gets the string from the original string with the beginning letter to the one before the last
      • indexof: returns the position of the first occurrence of a string, returns -1 if there is none.
      • length: returns the length of the string
      • compareto: compares two strings and returns true if they both have the exact same characters in the exact same position
  3. Constants

    • Set values that cannot be changed anywhere else in the code. Variables can be set as constants by using the "final" field.
  4. Assignment, incrementing, decrementing

    • Assignment: done with the "=" operator, sets the value to a variable or object.
    • Incrementing and decrementing: can be done with the "++" or "--" operator
  5. Arithmetic operations

    • Uses of "+"
      • Adding two strings together
      • Using it to add two numbers together.
  6. Static Methods these are methods that are called in the class, but never by an object with the class type

    • In order to call one, you must the class name as the implicit parameter. You can use the object as the explicit parameter. For example, if we want to find x to the y power, you cannot call x.pow(y), you must call Math.pow(x, y).
  7. Converting number types

    • You can use what is called casting. This can be done by putting the type you want in front of the front value, it will change the value for that one time.
  8. Generating random numbers using Math.random

    • To generate random numbers, you construct an object of the Random class, and then apply one of the following methods. For example Random generator = new Random(); int d = 1 + generator.nextInt(6);
  9. Variable scope: need to make sure to make it minimal as possible, determining who needs it by using rather the public or private field, to lower the possibility of corruption for the variable

Informationen

Beschreibung
Mindmap am Fundamental Data Types, erstellt von John Hair am 26/04/2018.
Erstellt von
John Hair
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck