GoConqr has a new look! Let us know what you think.

Flashcards

Java Basics

ferreirati Oracle Certified Associate Oracle Certified Associate Portuguese 24 cards

Cards in this deck (24)

  1. 1members of a classmethods and fields
  2. 2no value at all will be returnedvoid
  3. 3how is called the full declaration of a method?method signature
  4. 4after compiling a .java what is the content of the created file?a file of bytecode by the same name with .class extension
  5. 5how to import all classes in a packages ?using a wildcard
    java.util.*;
    it does't slow down the program because the compiler figures out what's actually needed
  6. 6how to import the System class?import java.lang.System;
    It is not necessary because all the java.lang package is always automatically imported
  7. 7how do I import a class that is in the same package?You don't need to.
  8. 8Can i import child packages with a wildcard? I need: java.nio.files.Paths Should I use: java.nio.*No, wildcards only matches class names.
  9. 9what will happen? import java.util.*; import java.sql.*;Compiler error:
    The type Date is ambiguous.
    import java.util.Date;
    import java.sql.*;
    A explicitly class name import has precedence over any wildcard.
    You could use fully qualified class name.
  10. 10how to import the class ArrayList?import java.util.ArrayList;
  11. 11Is this a constructor? public void Chick() { }No, constructors don't have a return type.
  12. 12How many and what are the primitive types of Java?8
    boolean
    byte
    char
    short, int, long
    float, double
  13. 13What are the basic differences between the primitive types in Java and C?In Java they all have a fixed length.
  14. 14boolean (size, type)1 bit
    true / false
  15. 15byte (size, type, range)8 bits
    integral value
    -128, 127
    from -(2^7) to (2^7-1)
  16. 16short (size, type, range)16 bits
    integer value
    -32.768, 32.767
    from -(2^15) to (2^15-1)
  17. 17int (size, type, range)32 bits
    integer value
    -2.147.483.648, 2.147.483.647
    from -(2^31) to (2^31-1)
  18. 18long (size, type, range)64 bits
    integer value
    ~ -9*10^18, 9*10^18
    from -(2^63) to (2^63-1)
  19. 19float (size, type, range)32 bits
    floating-point value
    123.45f
  20. 20double (size, type, range)64 bits
    floating-point value
    123.456
  21. 21char16 bits
    Unicode value
    'a'
  22. 22How would you insert a literal float in the code? What about long, octal, hex, bin?123.5f
    adding an "f" at the end of the number
    LONG: 334.444L (upper case L plx)
    Octal: 0545
    Hexadecimal: 0x345
    Binary: 0b10110
  23. 23is this right? int num = 3_000_023;Yes, since Java 7 you can add underscores in numbers to make them easier to read.
    notAtStart = _1000.00; WRONG
    notAtEnd = 1000.00_; // WRONG
    notByDecimal = 1000_.00; // WRONG
    annoyingButLegal = 1_00_0.0_0; // OK
  24. 24Is this right? String nome = "Tiago"; int idade = null;Primitive types cannot be assigned to null.

Information

Description
Oracle Certified Associate Oracle Certified Associate Flashcards on Java Basics, created by ferreirati on 24/12/2015.
Created by
ferreirati
Views
11
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?