Giter Site home page Giter Site logo

pavel-rossinsky / java-a-beginners-guide-herbert-schildt Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 13.0 492 KB

Solutions to the exercises of the book "Java - A Beginner's Guide" seventh edition by Herbert Schildt

Home Page: http://www.oracle.com/events/global/en/java-outreach/resources/java-a-beginners-guide-1720064.pdf

Dockerfile 0.56% Shell 0.02% Java 99.42%
java-exercises herbert-schildt java-beginner java-examples java-book java

java-a-beginners-guide-herbert-schildt's People

Contributors

pavel-rossinsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

java-a-beginners-guide-herbert-schildt's Issues

Update the project documentation

Tasks

Cover the following topics:

  • technical prerequisites
  • add the picture of the cover of the book
  • how to install the project on Unix-based systems
  • how to compile tests initially
  • how to compile a test after editing
  • how to run a test
  • how to uninstall the project

Chapter 2: Introducing Data Types and Operators

Introducing Data Types and Operators

TODO:

  • Inches.java
  • Hypot.java
  • CharArithDemo.java
  • BoolDemo.java
  • Sound.java
  • SoundExt.java
  • StrDemo.java
  • DynInit.java
  • ScopeDemo.java
  • VarInitDemo.java
  • NestVar.java
  • ModDemo.java
  • RelLogOps.java
  • RelLogOps.java - understand Eager and Short-circuit operators (https://en.wikipedia.org/wiki/Short-circuit_evaluation)
  • SCops.java
  • SideEffects.java
  • LtoD.java
  • LtoD2.java
  • CastDemo.java
  • LogicalOpTable.java
  • LogicalOpTable2.java (the program uses and displays 1's and 0's rather that true and false)
  • PromDemo.java
  • UseCast.java
  • SelfTest4
  • SelfTest10

Chapter 3: Program Control Statements

Program Control Statements

TODO:

  • KbIn.java
  • Guess.java
  • Guess2.java
  • Guess3.java
  • Ladder.java
  • SwitchDemo.java
  • NoBreak.java
  • Help.java
  • SqrRoot.java
  • DecrFor.java
  • Comma.java
  • ForTest.java
  • Empty.java
  • Empty2.java
  • Empty3.java
  • ForVar.java
  • WhileDemo.java
  • Power.java
  • DWDemo.java
  • Guess4.java
  • Help2.java
  • BreakDemo.java
  • Break2.java
  • Break3.java
  • Break4.java
  • Break5.java
  • Break6.java
  • BreakErr.java
  • ContDemo.java
  • ContToLabel.java
  • Help3.java
  • FindFac.java
  • SelfTest1
  • SelfTest4
  • SelfTest7
  • SelfTest8
  • SelfTest9
  • SelfTest10

Chapter 10: Using I/O

Using I/O

TODO:

  • Describe the TODOs
  • Add docs

Using the Byte Steams

Reading Console Input

  • Class ReadBytes

Writing Console Output

  • Class WriteDemo

Reading and Writing Files Using Byte Streams

Inputting from a File

  • Class ShowFile
  • Class ShowFile -> ShowFile2

Automatically Closing a File

  • Class ShowFile -> ShowFile3
  • Class CopyFile

Reading and Writing Binary Data

  • Class RWData

A File Comparison Utility

  • Class CompFiles
  • Class CompFiles -> CompFiles2 (ignore the case of letters)
  • Class CompFiles -> CompFiles3 (display the position within the file where the files differ)

Random-Access Files

  • Class RandomAccessDemo

Using Java's Character-Based Streams

Console Input Using Character Streams

  • Class ReadChars
  • Class ReadLines

Console Output Using Character Streams

  • Class PrintWriterDemo

File I/O Using Character Streams

Using a FileWriter

  • Class KtoD

Using a FileReader

  • Using a FileReader

Using Java's Type Wrappers to Convert Numeric Strings

  • Class AvgNums

Createting a Disk-Based Help System

  • File helpfile.txt
  • Class Help
  • Class FileHelp

Self Test

  • Class SelfTest3
  • Class SelfTest4
  • Class SelfTest5
  • Class SelfTest6
  • Class SelfTest7
  • Class SelfTest8

Chapter 7: Inheritance

Inheritance

TODO:

  • Describe the TODOs
  • Add documentation with a reference to the ticket

Ihneritance Basics

  • Class TwoDShape
  • Class Triangle
  • Class Shapes
  • Class Rectangle

Member Access and Inheritance

  • Class Triangle -> Triangle2
  • Class TwoDShape -> TwoDShape2
  • Class Shapes2

Constructors and Inheritance

  • Class TwoDShape -> TwoDShape2
  • Class Triangle -> Triangle3
  • Class Shapes3

Using super to Call Superclass Constructors

  • Class TwoDShape -> TwoDShape4
  • Class Triangle -> Triangle4
  • Class Shapes4
  • Class TwoDShape -> TwoDShape5
  • Class Triangle -> Triangle5
  • Class Shapes5

Using super to Access Superclass Members

  • Class A
  • Class B
  • Class UseSuper

Extending the Vehicle Class

  • Class Vehicle
  • Class Truck
  • Class TruckDemo

Creating a Multilevel Hierarchy

  • Class TwoDShape -> TwoDShape6
  • Class Triangle -> Triangle6
  • Class ColorTriangle
  • Class Shapes6

When Are Constructors Executed?

  • Class A -> A2
  • Class B -> B2
  • Class C -> C2
  • Class OrderOfConstruction

Superclass References and Subclass Objects

  • Class X
  • Class Y
  • Class IncompatibleRef
  • Class X -> X2
  • Class Y -> Y2
  • Class SupSubRef
  • Class TwoDShape -> TwoDShape7
  • Class Triangle -> Triangle7
  • Class Shapes7

Method Overriding

  • Class A -> A3
  • Class B -> B3
  • Class Override
  • Class A -> A4
  • Class B -> B4
  • Class Overload

Overridden Methods Support Polymorphism

  • Class Sup
  • Class Sub1
  • Class Sub2
  • Class DynDispDemo

Applying Method Overriding to TwoDShape

  • Class TwoDShape -> TwoDShape8
  • Class Triangle -> Triangle8
  • Class Rectangle -> Rectangle8
  • Class DynShapes

Using Abstract Classes

  • Class TwoDShape -> TwoDShape9
  • Class Triangle - Triangle9
  • Class Rectangle -> Rectangle9
  • Class AbsShape

Using final

Using final with Data Members

  • Class ErrorMsg
  • Class FinalD

Self Test

  • Class SelfTest2

Chapter 5: More Data Types and Operators

More Data Types and Operators

TODO:

  • Describe the TODOs
  • Class ArrayDemo
  • Class MinMax
  • Class MinMax2
  • Class ArrayErr
  • Class Bubble
  • Class TwoD
  • Class Ragged
  • Class Squares
  • Class AssignARef
  • Class LengthDemo
  • Class ACopy
  • Class Queue
  • Class QDemo
  • Class ForEach
  • Class NoChange
  • Class ForEach2
  • Class Search
  • Class StringDemo
  • Class StrOps
  • Class StringArrays
  • Class SubStr
  • Class StringSwitch
  • Class CLDemo
  • Class Phone
  • Class UpCase
  • Class ShowBits
  • Class LowCase
  • Class Encode
  • Class NotDemo
  • Class ShiftDemo
  • Class ShowBits53 (Try This 5-3)
  • Class ShowBitsDemo
  • Class NoZeroDiv
  • Class NoZeroDiv2
  • Class SelfTest1
  • Class SelfTest2
  • Class SelfTest3
  • Class SelfTest4
  • Class SelfTest7
  • Class SelfTest13

Chapter 8: Packages and Interfaces

Packages and Interfaces

TODO:

  • Describe the TODOs
  • Add documentation with a reference to the ticket

Packages

A Short Package Example

  • Class Book
  • Class BookDemo

A Package Access Example

  • Class Book -> Book2
  • Class UseBook

Understanding protected members

  • Class Book -> Book3
  • Class ExtBook
  • Class ProtectDemo

Importing Packages

  • Class UseBook -> UseBook2

Implementing Interfaces

  • Interface Series
  • Class ByTwos
  • Class SeriesDemo
  • Class ByTwos -> ByTwos2
  • Class ByThrees

Using Interface References

  • Class SeriesDemo2

Creating a Queue Interface

  • Class ICharQ
  • Class FixedQueue
  • Class CircularQueue
  • Class DynQueue
  • Class IQDemo

Varibles in Interfaces

  • Interface IConst
  • Class IConstD

Interfaces Can Be Extended

  • Interface A
  • Interface B
  • Class MyClass
  • Class IFExtend

Default Interface Methods

Default Method Fundamentals

  • Interface MyIF
  • Class DefaulMethodDemo
  • Class MyIFImp2

A More practical Example of a Default Method

  • Interface Series -> Series2

Use static Methods in an Interface

  • Interface MyIF -> MyIF2

Private Interface Methods

  • Interface Series -> Series3

Self Test

  • SelfTest1 -> IQDemo2
  • SelfTest9 -> IVehicle

Chapter 9: Exception Handling

Exception Handling

TODO:

  • Describe the TODOs
  • Add docs

The Exception Hierarchy

A Simple Exception Example

  • Class ExcDemo1
  • Class ExcTest
  • Class ExcDemo2

The Consequences of an Uncaught Exception

  • Class NotHandled
  • Class ExcTypeMismatch

Exceptions Enable You to Handle Errors Gracefully

  • Class ExcDemo3

Using Multiple catch Statements

  • Class ExcDemo4

Catching Subclass Exceptions

  • Class ExcDemo5

Try Blocks Can Be Nested

  • Class NestTrys

Throwing an Exception

  • Class ThrowDemo

Rethrowing an Exception

  • Class Rethrow
  • Class RethrowDemo

A Closer Look at Throwable

  • Class ExcTest -> ExcTest2
  • Class UseThrowableMethods

Using finally

  • Class UseFinally
  • Class FinallyDemo

Using throws

  • Class ThrowsDemo

Three Additional Exception Features

  • Class MultiCatch

Creating Exception Subclasses

  • Class NonIntResutException
  • Class CustomExceptionDemo

Adding Exception to the Queue Class

  • Class QueueFullException
  • Class QueueEmptyException
  • Class FixedQueue
  • Class QExcDemo
  • Interface ICharQ

Chapter 6: A Closer Look at Methods and Classes

A Closer Look at Methods and Classes

TODO:

  • Describe the TODOs
  • Add a reference to the ticket

Controlling Access to Members

  • Class MyClass
  • Class AccessDemo
  • Class FailSoftArray
  • Class FSDemo
  • Class Queue

Pass Objects to Methods

  • Class Block
  • Class PassOb
  • Class Test
  • Class CallByValue
  • Class PassObRef

Returning Objects

  • Class ErrorMsg
  • Class ErrMsg
  • Class Err
  • Class ErrorInfo
  • Class ErrInfo

Method Overloading

  • Class Overload
  • Class OverloadDemo
  • Class Overload2
  • Class TypeConv

Overloading Constructors

  • Class MyClass -> MyClass2
  • Class OverloadConsDemo
  • Class Summation
  • Class SumDemo
  • Class QDemo2
  • Class Queue -> Queue2

Recursion

  • Class Factorial
  • Class Recursion

Understanding static

  • Class StaticDemo
  • Class SDemo
  • Class StaticMeth
  • Class SDemo2
  • Class StaticError
  • Class StaticBlock
  • Class SDemo3
  • Class QSDemo
  • Class QuickSort

Introducing Nested and Inner Classes

  • Class Outer
  • Class Inner
  • Class NestedClassDemo
  • Class LocalClassDemo

Varargs: Variable-Length Arguments

  • Class VarArgs
  • Class VarArgs2

Overloading Varargs Methods

  • Class VarArgs3

Varargs and Ambiguity

  • Class VarArgs4

Self Test

  • SelfTest3
  • SelfTest4
  • SelfTest6
  • SelfTest13

Integrate Maven as a build tool

Tasks:

  • Learn the easiest way to integrate Maven
  • Adapt Docker to Maven
  • Add the basic version of a pom file
  • Find a way to run the examples one by one
  • Update the project documentation (will do later in #8)

Chapter 11: Multithreaded Programming

Multithreaded Programming

TODO:

  • Describe the TODOs
  • Add docs

Creating a Thread

  • Class MyThread
  • Class UseThreads
  • Class MyThread -> MyThread2
  • Class ThreadVariations

Extending Thread

  • Class MyThread -> MyThread3
  • Class ExtendThread

Creating Multiple Threads

  • Class MyThread -> MyThread4
  • Class MoreThreads

Determining When a Thread Ends

  • Class MoreThreads -> MoreThreads2
  • Class MyThread -> MyThread5
  • Class JoinThreads

Thread Priorities

  • Class Priority
  • Class PriorityDemo

Using Synchronized Methods

  • Class SumArray
  • Class MyThread -> MyThread6
  • Class Sync

The synchronized Statement

  • Class SumArray -> SumArray2
  • Class MyThread -> MyThread7
  • Class Sync -> Sync2

Thread Communication Using notify(), wait(), and notifyAll()

An Example That Uses wait() and notify()

  • Class TickTock
  • Class MyThread -> MyThread8
  • Class ThreadCom
  • Class TickTock -> TickTock2

Suspending, Resuming, and Stopping Threads

  • Class MyThread -> MyThread9
  • Class Suspend

Using the Main Thread

  • Class UseMain

Self Test

  • SelfTest4
  • SelfTest5 -> MyThrd
  • SelfTest8
  • SelfTest12

Chapter 4: Introducing Classes, Objects, and Methods

Introducing Classes, Objects, and Methods

TODO:

  • Describe the TODOs
  • Class Vehicle
  • Class VehicleDemo
  • Class TwoVehicles
  • Class AddMeth
  • Class RetMeth
  • Class ChkNum
  • Class ParamDemo
  • Class Factor
  • Class IsFact
  • Class CompFuel
  • Class Help
  • Class HelpClassDemo
  • Class MyClass
  • Class ConsDemo
  • Class ParmConstDemo
  • Class VehConsDemo
  • Class Pwr
  • Class DemoPwr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.