CheckpointJavaCore

Java Core Program

Task 3 Task 4 Task 5 Task 6

Here are the main articles:



Java intro - theoretical part of the language

  1. JVM, JDK, JRE
  2. Class loader
  3. Garbage collector

HW:



Java intro - theoretical part of the language

  1. Objects
  2. Variables, variable initialization, memory allocation
  3. Variable types: primitive and Objects
  4. Packages (package organization strategies)
  5. Java operators
  6. Expressions, statements and Blocks

HW:



Control statements and modifiers for methods/variables

  1. Control flow statements (if-then, if-then-else, switch)
  2. Loops (for, while, do-while, foreach)
  3. Access modifiers: private, package, protected, private (variables, methods)
  4. Static modifier for variable and methods, static block of initialization
  5. Final (variable, methods, constructors)

HW:



Class, constructors, overriding, inheritance

  1. OOP principles (Encapsulation, Inheritance, Polymorphism)
  2. Class abstraction (class, object)
  3. Constructors
  4. Order of object initialization (static blocks, static fields, parent constructor calls in inheritance chain)
  5. Overriding, overloading. Difference between ordinary and static methods “overriding”. Can variables be overridden?

HW:



Nested Classes, Enum type

  1. Nested classes
  2. Local classes
  3. Anonymous classes
  4. Enum type
  5. Classes modifiers: final, static/non-static, access modifiers

HW:



Interfaces and abstract classes, some design patterns

  1. Interface (definition, purposes, related Java key words, multiple “inheritance” via interfaces, @Overridden annotation)
  2. Abstract class (definition, purposes, related Java keywords, inheritance rules)
  3. Design patterns Factory, Template method, Singleton, Chain of responsibilities, Builder, Adapter

HW:



Numbers and Strings

  1. String class
  2. String concatenation (operations under + operator)
  3. StringBuilder, StringBuffer
  4. Constant pool
  5. String equals, hashcode methods
  6. Number classes (Integer, Double,...)
  7. Numbers autoboxing and unboxing

HW:



Java Collections

  1. Java collection hierarchy
  2. The Collection Interface
  3. The Set Interface and implementations
  4. The List Interface and implementations
  5. The Queue Interface and implementations
  6. The Deque Interface and implementations
  7. The Map Interface and implementations
  8. The SortedSet Interface and implementations
  9. The SortedMap Interface and implementations

HW:



Java Generics

  1. Java Generics

HW:



Multithreading

  1. Monitors
  2. Synchronization
  3. Class Thread (thread start, run)
  4. Runnable, Callable interfaces
  5. Synchronized, volatile keywords

HW:



Error handling with Exceptions

  1. Throwable
  2. Error
  3. Exception, RuntimeException
  4. Hierarchy of exceptions
  5. try-catch-finally
  6. try-with-resources for AutoClosable classes (introduced java 7)

HW:



Unit testing

  1. Unit testing (what is it? purposes?)
  2. Junit
  3. Mock objects (Mockito overview)

HW:



Java Naming Conventions

HW:



Build automation tools (optional paragraphs)

  1. Maven
  2. Gradle

HW:



New features in Java 8. Design patterns (optional paragraphs)

HW:






Tasks that should be sent to us:

These tasks should be sent to checkpoint.10per@gmail.com before 6th of the April 2015. Please, use mail accounts that you used to send HTML tasks. Any works sent from other mail accounts won't be checked. Please, specify mail topic "Java - task". Before implementing any task read Java Naming Conventions attentively.

  1. Implement application that “shuffle” an array randomly. Just 25% of array elements should be “shuffled”. “Shuffled” positions are chosen randomly too. Implement unit tests for this functionality. Array can be one or two dimensional. Array is input param.
  2. Implement 3 data structures that use all features of LinkedList, ArrayList, Map. This data structures should have all appropriate functionalities and also should automatically remove “old” objects. “Old” means object that were created earlier then some date/time. Implement unit tests for this functionality. Date/time should be input param.
  3. Implement an app that calculate a sum of series 2^(i - (-1)^i). i from 1 to n. Calculation should be done in parallel mode. Input params: n, count of threads. Result should be the same on all runs for specific n. Please, implement 2 variants: with executors and creating your own thread pool. Implement unit tests for this functionality. Please, implement ability to run this program from console and from file. Example: 5 7 (first number is n, then space, then count of threads, line break). File exampe
  4. Create a program that accept expression that describe the phone number:
    • The main part of the phone consists of three groups, each with a length from 2 to 3 numbers (eg., 55 55 555);
    • Optionally before the main number - area code inside the country, 3-4 numbers (999, 2345);
    • Optionally before the area code - the international country code, starting with a "+" (eg., 7) or service area code (8);
    • All of the phone parts can be connected with a space or a hyphen; area code can optionally be taken in parentheses.

    This program should accept 2 modes: inputs from console, inputs from file. File example. Implement unit tests for this functionality.

  5. Using regular expressions, clean code in the file src.java from comments. Program should accept any correct java source file. Implement unit tests for this functionality.
  6. Implement app that calculate frequency of words in text using several threads. Path to the file, count of threads are given params, separated by space in console. Create unit tests for this functionality.

Course work. Mobile networks

Implement a mobile network. Think about your mobile phones. Try to emulate real system. You have several mobile operators and can instantiate new one: Life, MTS, Kievstar and so on.

Mobile operators have

Try to emulate all actions with mobile package (subscribe, unsubscribe, shift to another mobile package, charge account, use your money/minutes while talking (emulate “mobile incoming call”, “mobile outgoing call”, “mobile incoming SMS”, “mobile outgoing SMS”, “mobile internet”), try to make your account zero or less than zero balanced, charge account again and try to buy a service that cost more than your current balance, receive a notification that you do not have enough money), emulate connection inside internal network, or with other operators (you need to create several consumers). Test your application properly with several users, emulate connections, sending/receiving SMS, calls. Implement several operators with different mobile towers. You can simplify functionality of mobile towers and imagine that all consumers are located in points that are not changed (it means that distance for one consumer to towers doesn't change during the period of your app working). However, if you want to have a dynamic environment you are welcome.

Do not afraid to use design patterns. Try to find and implement at least 2 design patterns that matches your situation. Implement unit test with mocked objects for whole system.

Please, note that all mobile packages and costs should be easily changed (classes contains setters, getters, appropriate constructors and architecture design). You are welcome to use database storages if you want, but it's optional. If you decide to use it, you can use also build automation tool for resolving dependencies (Maven, Gradle, etc.).