07/22/2024 Rivka Scheinberg Post in Determining the Range,Garbage Collection,Implementing an Interface,Non-Static Member Classes,Oracle Exams,Static Member Types Leave a Comment on Incidental Whitespace – Selected API Classes Incidental Whitespace – Selected API Classes Incidental Whitespace So far the lines in the text blocks have all been left-justified. This need not be the case. Indentation can be used if desired. However, one needs to be careful as incidental whitespace from each line is removed… Continue Reading
01/22/2024 Rivka Scheinberg Post in Non-Static Member Classes,Oracle Exams Leave a Comment on Garbage Collection – Object Lifetime Garbage Collection – Object Lifetime 10.1 Garbage Collection Efficient memory management is essential in a runtime system. Storage for objects is allocated in a designated part of the memory called the heap, which has a finite size. Garbage collection (GC) is a process of managing… Continue Reading
06/22/2023 Rivka Scheinberg Post in Determining the Range,Non-Static Member Classes,Oracle Exams Leave a Comment on Generating the Same Sequence of Pseudorandom Numbers – Selected API Classes Generating the Same Sequence of Pseudorandom Numbers – Selected API Classes Generating the Same Sequence of Pseudorandom Numbers The way in which we have used the pseudorandom number generator up to now cannot guarantee the same sequence of pseudorandom numbers each time the program is run. This is because the pseudorandom… Continue Reading
02/22/2023 Rivka Scheinberg Post in Garbage Collection,Non-Static Member Classes,Oracle Exams Leave a Comment on Reversing Characters in a String Builder – Selected API Classes Reversing Characters in a String Builder – Selected API Classes Reversing Characters in a String Builder The following method in the class StringBuilder reverses the contents of a string builder: StringBuilder reverse() Examples of using methods that modify string builders: Click here to view code image StringBuilder builder = new… Continue Reading
10/22/2022 Rivka Scheinberg Post in Implementing an Interface,Non-Static Member Classes,Oracle Exams Leave a Comment on Non-Static Member Classes – Nested Type Declarations Non-Static Member Classes – Nested Type Declarations 9.3 Non-Static Member Classes Declaring Non-Static Member Classes Non-static member classes are inner classes—that is, non-static nested classes— that are defined without the keyword static as instance members of either a class, an enum type, or a record class. Non-static… Continue Reading
09/22/2022 Rivka Scheinberg Post in Non-Static Member Classes,Oracle Exams,Static Member Types Leave a Comment on Constructing BigDecimal Numbers – Selected API Classes Constructing BigDecimal Numbers – Selected API Classes Constructing BigDecimal Numbers Selected constructors of the BigDecimal class are shown below. BigDecimal(int value)BigDecimal(long value)BigDecimal(double value) Create a BigDecimal with the decimal number representation of the specified value. Note that these constructors can result in a loss of precision if… Continue Reading
07/22/2022 Rivka Scheinberg Post in Determining the Range,Garbage Collection,Implementing an Interface,Non-Static Member Classes,Oracle Exams,Static Member Types Leave a Comment on Exponential Functions – Selected API Classes Exponential Functions – Selected API Classes Exponential Functions Click here to view code image static double pow(double d1, double d2) Returns the value of d1 raised to the power of d2 (i.e., d1d2). Click here to view code image static double exp(double d) Returns the exponential… Continue Reading
03/22/2022 Rivka Scheinberg Post in Non-Static Member Classes,Oracle Exams Leave a Comment on Local Classes – Nested Type Declarations Local Classes – Nested Type Declarations 9.4 Local Classes Declaring Local Classes A local class is an inner class that is defined in a block. This can be essentially any context where a local block or block body is allowed: a method, a constructor, an initializer… Continue Reading
10/22/2021 Rivka Scheinberg Post in Determining the Range,Non-Static Member Classes,Oracle Exams Leave a Comment on Instantiating Static Member Classes – Nested Type Declarations Instantiating Static Member Classes – Nested Type Declarations Instantiating Static Member Classes A static member class can be instantiated without first creating an instance of the enclosing class. Example 9.2 shows a client creating an instance of a static member class at (14) using the new operator and… Continue Reading
05/22/2021 Rivka Scheinberg Post in Garbage Collection,Non-Static Member Classes,Oracle Exams Leave a Comment on Inserting Characters in a String Builder – Selected API Classes Inserting Characters in a String Builder – Selected API Classes Inserting Characters in a String Builder The overloaded method insert() can be used to insert characters at a given offset in a string builder. Click here to view code image StringBuilder insert(int offset, Object obj)StringBuilder insert(int dstOffset, CharSequence seq)StringBuilder insert(int… Continue Reading