Learn how to use lists in Java, how to use List<T> and ArrayList<T>, how to process lists of elements.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-lists
Java Foundations: Maps, Lambda and Stream APISvetlin Nakov
Learn how to work with maps in Java, how to use the Map<K, V> interface and the API classes HashMap<K,V> and TreeMap<K, V>. Learn how to work with lambda expressions and how to use the Java stream API to process sequences of elements, how to filter, transform and order sequences.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-maps-lambda-and-stream-api/
Here we are going to learn why is a good practice to use interfaces and how they are different from abstraction classes. Further more we are going to see how which one of them to use.
This document discusses collections and queries in Java, including associative arrays (maps), lambda expressions, and the stream API. It provides examples of using maps like HashMap, LinkedHashMap and TreeMap to store key-value pairs. Lambda expressions are introduced as anonymous functions. The stream API is shown processing collections through methods like filter, map, sorted and collect. Examples demonstrate common tasks like finding minimum/maximum values, summing elements, and sorting lists.
Learn about how to define and invoke methods in Java, how to use parameters and return results. Watch the video lesson here:
https://softuni.org/code-lessons/java-foundations-certification-methods
17. Java data structures trees representation and traversalIntro C# Book
In this chapter we will discuss tree data structures, like trees and graphs. The abilities of these data structures are really important for the modern programming. Each of this data structures is used for building a model of real life problems, which are efficiently solved using this model.
The document discusses variables and operators in Java. It defines variables as containers that store data like numbers and letters, and notes that data types determine what values can be stored. It then covers various data types including primitive types like int and float, and reference types like Strings and Arrays. The document also discusses operators like arithmetic, logical, and assignment operators. It provides examples of declaring and using variables and operators in Java code.
Inheritance allows classes to extend and inherit properties from base classes. This creates class hierarchies where subclasses inherit and can override methods from superclasses. Inheritance promotes code reuse through extension when subclasses share the same role as the base class. Composition and delegation are alternative approaches to code reuse that may be preferable in some cases over inheritance.
In this lesson you will learn how to use basic syntax, conditions, if-else statements and loops (for-loop, while-loop and do-while-loop) in Java and how to use the debugger.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-basic-syntax-conditions-and-loops
This document provides information about Java collections framework. It discusses various collection interfaces like Collection, List, Set, Queue, Map and their implementations like ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap. It also covers topics like sorting collections using Comparable and Comparator interfaces, overriding equals() and hashCode() methods.
The Java Stack class implements a last-in, first-out (LIFO) data structure called a stack. It extends the Vector class and inherits its methods. Elements are added to the top of the stack using push() and removed from the top with pop(). The search() method returns the position of an element from the top, and empty() checks if the stack is empty. Common uses of stacks in Java include storing and retrieving elements in LIFO order.
The document discusses various PHP array functions including:
- Array functions like array_combine(), array_count_values(), array_diff() for comparing and merging arrays.
- Sorting arrays with asort(), arsort(), ksort(), krsort().
- Other functions like array_search(), array_sum(), array_rand() for searching, summing and random values.
- Modifying arrays with array_push(), array_pop(), array_shift() for adding/removing elements.
The document provides examples of using each array function in PHP code snippets.
The document provides information on object-oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism, and abstraction. It defines classes like Shape, Rectangle, Circle and Triangle to demonstrate these concepts. It also discusses Java data types, constructors, access modifiers, interfaces and abstract classes.
The document discusses the introduction and advantages of lambda expressions and functional programming in Java 8. Some key points include:
- Lambda expressions allow passing behaviors as arguments to methods, simplifying code by removing bulky anonymous class syntax. This enables more powerful and expressive APIs.
- Streams provide a way to process collections of data in a declarative way, leveraging laziness to improve efficiency. Operations can be pipelined for fluent processing.
- Functional programming with immutable data and avoidance of side effects makes code more modular and easier to reason about, enabling optimizations like parallelism. While not natively supported, Java 8 features like lambda expressions facilitate a more functional approach.
This document provides an overview of the Java Collections Framework. It discusses core collection interfaces like List, Set, and Map and their common implementations like ArrayList, HashSet, and HashMap. It also covers sorting collections with Comparable and Comparator, searching collections with binary search, and using utility methods in the Collections class. Examples are provided to illustrate usage of various collection classes and methods.
This document discusses object-oriented programming concepts in PHP, including classes, objects, inheritance, polymorphism, and data hiding. It provides examples of each concept, such as using the extends keyword for inheritance and interfaces for polymorphism. Magic functions like __get() and __set() are also covered. Keywords in PHP OOP like class, interface, implements, and extends are highlighted.
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
In this session we begin with modelling the attack surface of Java deserialization, which often leads to remote code execution (RCE), by showcasing vulnerabilities we found in modern and widely used applications and frameworks. We extend existing research about risks of deserialization broadening the attack surface. After a live demo of getting a Meterpreter shell in a modern Java endpoint setup we delve into the exploitation styles for this vulnerability to lay the foundation of the first of three key takeaways for the attendees:
The first key takeaway is identification of test types that should be executed during a dynamic assessment of an application in order to find this kind of vulnerability. This includes analyzing the deserialization interface and using blackbox tests to create payloads with gadgets matching the application’s classpath to verify the RCE. Discussion extends to cover indirect deserialization interfaces that use non-binary data formats, such as XML-based interfaces, which can also act as a driver for deserialization within the application.
The next key takeaway covers the realm of static code analysis (SAST). We present code patterns security reviewers should look for when doing whitebox assessments of applications or frameworks. This is especially interesting for code offering dynamic functionality including AOP, generic mappings, reflection, interceptors, etc. - all of which have a high probability of including code that can facilitate as deserialization gadgets and thus help the attackers in exploiting deserialization vulnerabilities. In this section we present the techniques used to find the vulnerabilities within the popular frameworks showcased during the live demo at the session’s start.
Finally we conclude with tips on implementing different techniques of hardening measures for applications offering deserialisation interfaces (either direct binary deserialization interfaces or indirect XML-based ones) to give the attendees the third key takeaway: protecting applications properly. This includes ways to verify data integrity prior to deserialization and ways to properly inspect the data before it’s handled by the Java deserialization process.
--
This talk was presented by Christian Schneider & Alvaro Muñoz at the OWASP BeNeLux Day 2016.
In this core java training session, you will learn Collections – Lists, Sets. Topics covered in this session are:
• List – ArrayList, LinkedList
• Set – HashSet, LinkedHashSet, TreeSet
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
The document discusses Structured Query Language (SQL) and Java Database Connectivity (JDBC). It provides examples of using SQL statements like SELECT, INSERT, UPDATE, DELETE to query and manipulate data in database tables. It also demonstrates how to connect to databases like MySQL from Java using JDBC, execute SQL queries to retrieve and manipulate data, handle transactions and exceptions. Key classes discussed are Connection, Statement, PreparedStatement, CallableStatement and their methods.
This document provides an agenda for a Java 8 training session that covers Lambdas and functional interfaces, the Stream API, default and static methods in interfaces, Optional, the new Date/Time API, and Nashorn JavaScript engine. It includes sections on Lambda expressions and method references syntax, functional interfaces, built-in functional interfaces, streams versus collections, using Optional to avoid null checks, extending interfaces with default methods, and key concepts of the new Date/Time and Nashorn JavaScript APIs.
Learn how to use arrays in Java, how to enter array, how to traverse an array, how to print array and more array operations.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-arrays
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
In this core java training session, you will learn Collections - Maps. Topics covered in this session are:
• Collections – Maps
• Map Interface
• Map methods
• Mapuse
• Hashmap
• Treemap
• Utilities
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
The .NET Framework class library provides access to system functionality through classes, interfaces, and value types, forming the foundation for .NET applications. It contains core classes for common data types, events, exceptions, and more. The library also enables database access via ADO.NET, file input/output, and defines generic data structures known as collections in the System.Collections namespace.
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
(Video of these slides here http://fsharpforfunandprofit.com/ddd)
Statically typed functional programming languages like F# encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers.
Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time.
In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
Code, links to video, etc., at http://fsharpforfunandprofit.com/ddd
For more on DDD and F# see:
http://fsharpforfunandprofit.com/ddd/
http://tomasp.net/blog/type-first-development.aspx/
http://gorodinski.com/blog/2013/02/17/domain-driven-design-with-fsharp-and-eventstore/
The document discusses defining classes and objects in Java. It covers defining simple classes, class elements like fields and methods, constructors, properties, static members, and using classes by creating instances and calling methods. Key points include classes define the structure of objects, constructors initialize object state, properties encapsulate fields, and static members are associated with a class not individual objects.
In this chapter we are going to get familiar with the basic concepts of object-oriented programming – classes and objects – and we are going to explain how to use classes from the standard libraries of .NET Framework. We are going to mention some commonly used system classes and see how to create and use their instances (objects). We are going to discuss how we can access fields of an object, how to call constructors and how to work with static fields in classes. Finally, we are going to get familiar with the term "namespaces" – how they help us, how to include them and use them.
Inheritance allows classes to extend and inherit properties from base classes. This creates class hierarchies where subclasses inherit and can override methods from superclasses. Inheritance promotes code reuse through extension when subclasses share the same role as the base class. Composition and delegation are alternative approaches to code reuse that may be preferable in some cases over inheritance.
In this lesson you will learn how to use basic syntax, conditions, if-else statements and loops (for-loop, while-loop and do-while-loop) in Java and how to use the debugger.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-basic-syntax-conditions-and-loops
This document provides information about Java collections framework. It discusses various collection interfaces like Collection, List, Set, Queue, Map and their implementations like ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap. It also covers topics like sorting collections using Comparable and Comparator interfaces, overriding equals() and hashCode() methods.
The Java Stack class implements a last-in, first-out (LIFO) data structure called a stack. It extends the Vector class and inherits its methods. Elements are added to the top of the stack using push() and removed from the top with pop(). The search() method returns the position of an element from the top, and empty() checks if the stack is empty. Common uses of stacks in Java include storing and retrieving elements in LIFO order.
The document discusses various PHP array functions including:
- Array functions like array_combine(), array_count_values(), array_diff() for comparing and merging arrays.
- Sorting arrays with asort(), arsort(), ksort(), krsort().
- Other functions like array_search(), array_sum(), array_rand() for searching, summing and random values.
- Modifying arrays with array_push(), array_pop(), array_shift() for adding/removing elements.
The document provides examples of using each array function in PHP code snippets.
The document provides information on object-oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism, and abstraction. It defines classes like Shape, Rectangle, Circle and Triangle to demonstrate these concepts. It also discusses Java data types, constructors, access modifiers, interfaces and abstract classes.
The document discusses the introduction and advantages of lambda expressions and functional programming in Java 8. Some key points include:
- Lambda expressions allow passing behaviors as arguments to methods, simplifying code by removing bulky anonymous class syntax. This enables more powerful and expressive APIs.
- Streams provide a way to process collections of data in a declarative way, leveraging laziness to improve efficiency. Operations can be pipelined for fluent processing.
- Functional programming with immutable data and avoidance of side effects makes code more modular and easier to reason about, enabling optimizations like parallelism. While not natively supported, Java 8 features like lambda expressions facilitate a more functional approach.
This document provides an overview of the Java Collections Framework. It discusses core collection interfaces like List, Set, and Map and their common implementations like ArrayList, HashSet, and HashMap. It also covers sorting collections with Comparable and Comparator, searching collections with binary search, and using utility methods in the Collections class. Examples are provided to illustrate usage of various collection classes and methods.
This document discusses object-oriented programming concepts in PHP, including classes, objects, inheritance, polymorphism, and data hiding. It provides examples of each concept, such as using the extends keyword for inheritance and interfaces for polymorphism. Magic functions like __get() and __set() are also covered. Keywords in PHP OOP like class, interface, implements, and extends are highlighted.
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
In this session we begin with modelling the attack surface of Java deserialization, which often leads to remote code execution (RCE), by showcasing vulnerabilities we found in modern and widely used applications and frameworks. We extend existing research about risks of deserialization broadening the attack surface. After a live demo of getting a Meterpreter shell in a modern Java endpoint setup we delve into the exploitation styles for this vulnerability to lay the foundation of the first of three key takeaways for the attendees:
The first key takeaway is identification of test types that should be executed during a dynamic assessment of an application in order to find this kind of vulnerability. This includes analyzing the deserialization interface and using blackbox tests to create payloads with gadgets matching the application’s classpath to verify the RCE. Discussion extends to cover indirect deserialization interfaces that use non-binary data formats, such as XML-based interfaces, which can also act as a driver for deserialization within the application.
The next key takeaway covers the realm of static code analysis (SAST). We present code patterns security reviewers should look for when doing whitebox assessments of applications or frameworks. This is especially interesting for code offering dynamic functionality including AOP, generic mappings, reflection, interceptors, etc. - all of which have a high probability of including code that can facilitate as deserialization gadgets and thus help the attackers in exploiting deserialization vulnerabilities. In this section we present the techniques used to find the vulnerabilities within the popular frameworks showcased during the live demo at the session’s start.
Finally we conclude with tips on implementing different techniques of hardening measures for applications offering deserialisation interfaces (either direct binary deserialization interfaces or indirect XML-based ones) to give the attendees the third key takeaway: protecting applications properly. This includes ways to verify data integrity prior to deserialization and ways to properly inspect the data before it’s handled by the Java deserialization process.
--
This talk was presented by Christian Schneider & Alvaro Muñoz at the OWASP BeNeLux Day 2016.
In this core java training session, you will learn Collections – Lists, Sets. Topics covered in this session are:
• List – ArrayList, LinkedList
• Set – HashSet, LinkedHashSet, TreeSet
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
The document discusses Structured Query Language (SQL) and Java Database Connectivity (JDBC). It provides examples of using SQL statements like SELECT, INSERT, UPDATE, DELETE to query and manipulate data in database tables. It also demonstrates how to connect to databases like MySQL from Java using JDBC, execute SQL queries to retrieve and manipulate data, handle transactions and exceptions. Key classes discussed are Connection, Statement, PreparedStatement, CallableStatement and their methods.
This document provides an agenda for a Java 8 training session that covers Lambdas and functional interfaces, the Stream API, default and static methods in interfaces, Optional, the new Date/Time API, and Nashorn JavaScript engine. It includes sections on Lambda expressions and method references syntax, functional interfaces, built-in functional interfaces, streams versus collections, using Optional to avoid null checks, extending interfaces with default methods, and key concepts of the new Date/Time and Nashorn JavaScript APIs.
Learn how to use arrays in Java, how to enter array, how to traverse an array, how to print array and more array operations.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-arrays
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
In this core java training session, you will learn Collections - Maps. Topics covered in this session are:
• Collections – Maps
• Map Interface
• Map methods
• Mapuse
• Hashmap
• Treemap
• Utilities
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
The .NET Framework class library provides access to system functionality through classes, interfaces, and value types, forming the foundation for .NET applications. It contains core classes for common data types, events, exceptions, and more. The library also enables database access via ADO.NET, file input/output, and defines generic data structures known as collections in the System.Collections namespace.
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
(Video of these slides here http://fsharpforfunandprofit.com/ddd)
Statically typed functional programming languages like F# encourage a very different way of thinking about types. The type system is your friend, not an annoyance, and can be used in many ways that might not be familiar to OO programmers.
Types can be used to represent the domain in a fine-grained, self documenting way. And in many cases, types can even be used to encode business rules so that you literally cannot create incorrect code. You can then use the static type checking almost as an instant unit test — making sure that your code is correct at compile time.
In this talk, we'll look at some of the ways you can use types as part of a domain driven design process, with some simple real world examples in F#. No jargon, no maths, and no prior F# experience necessary.
Code, links to video, etc., at http://fsharpforfunandprofit.com/ddd
For more on DDD and F# see:
http://fsharpforfunandprofit.com/ddd/
http://tomasp.net/blog/type-first-development.aspx/
http://gorodinski.com/blog/2013/02/17/domain-driven-design-with-fsharp-and-eventstore/
The document discusses defining classes and objects in Java. It covers defining simple classes, class elements like fields and methods, constructors, properties, static members, and using classes by creating instances and calling methods. Key points include classes define the structure of objects, constructors initialize object state, properties encapsulate fields, and static members are associated with a class not individual objects.
In this chapter we are going to get familiar with the basic concepts of object-oriented programming – classes and objects – and we are going to explain how to use classes from the standard libraries of .NET Framework. We are going to mention some commonly used system classes and see how to create and use their instances (objects). We are going to discuss how we can access fields of an object, how to call constructors and how to work with static fields in classes. Finally, we are going to get familiar with the term "namespaces" – how they help us, how to include them and use them.
The document discusses Scala concepts including higher-order functions, anonymous functions, currying, tail recursion, classes and objects, properties with getters and setters, object-private fields, auxiliary constructors, primary constructors, nested classes, and singleton objects. It provides code examples to illustrate these Scala features and explains how they work and how they compare to similar concepts in other languages like Java. The document is intended as a lesson on these Scala programming concepts.
In this session, you will learn:
1. Deep dive into coding OOP with Java… with practical examples.
2. How to create a class
3. How to create objects
4. How to create instance variables
5. How to create class variables
6. Constructors
This document provides an overview of several Java standard classes including Date, SimpleDateFormat, Scanner, Math, and DecimalFormat. It discusses how to create objects from these classes, commonly used methods, and examples of how to incorporate them into programs. For Date, it demonstrates getting the current date, comparing dates, and formatting dates. For Scanner, it shows reading user input. For Math, it lists common mathematical methods. For DecimalFormat, it demonstrates formatting numbers to a specified number of decimal places.
The static keyword in Java is used for memory management. It allows variables and methods to belong to the class rather than instances of the class. Static variables and methods are associated with the class, not objects, so they can be accessed without creating an object of the class. Static variables only have one copy in memory and static methods can access static variables and change their values without creating an object. Examples demonstrate how to declare static variables and methods and how they differ from non-static variables and methods.
In this session you will learn:
Deep dive into coding OOP with Java… with practical examples.
How to create a class
How to create objects
How to create instance variables
How to create class variables
Constructors
For more information: https://www.mindsmapped.com/courses/software-development/become-a-java-developer-hands-on-training/
In this chapter we will understand how to define custom classes and their elements. We will learn to declare fields, constructors and properties for the classes. We will revise what a method is and we will broaden our knowledge about access modifiers and methods. We will observe the characteristics of the constructors and we will set out how the program objects coexist in the dynamic memory and how their fields are initialized. Finally, we will explain what the static elements of a class are – fields (including constants), properties and methods and how to use them properly. In this chapter we will also introduce generic types (generics), enumerated types (enumerations) and nested classes.
In this chapter we will understand how to define custom classes and their elements. We will learn to declare fields, constructors and properties for the classes. We will revise what a method is and we will broaden our knowledge about access modifiers and methods.
The document discusses classes, objects, and methods in object-oriented programming. It introduces the Dice class as an example, which models the behavior and properties of dice. The Dice class has private member variables to store the number of sides and rolls, and public methods like Roll() and NumSides() to access and manipulate these properties. The document explains concepts like encapsulation, properties, static methods, and the importance of classes and objects in organizing code into reusable components.
In this core java training session, you will learn OOP with Java Contd. Topics covered in this session are:
• Review of last class concepts
• Types of Inheritance and a look at Aggregation
• Polymorphism
• Method overloading
• Method overriding
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
The document discusses constructors in Java. It defines constructors as special methods that initialize objects. Constructors are invoked during object creation and provide initial values for object fields. The document covers default constructors that provide default values if no constructor is defined, parameterized constructors that initialize fields with passed in values, and constructor overloading which allows multiple constructors with different parameters. It provides examples of each type of constructor.
The document summarizes new features that have been added to C# programming language over different versions of Visual Studio. It discusses features such as generics, lambda expressions, LINQ, tuples, pattern matching, exception filters, auto-property initializers, expression-bodied members and more. It also provides code examples to illustrate some of these features like tuples, deconstruction, pattern matching with case statements, async Main method and others.
The document provides examples of code translations between OCaml and Java, asking the user to complete code snippets in Java based on OCaml examples. It tests knowledge of data structures, classes, interfaces, inheritance, exceptions, recursion, and the object-oriented design process. The user is prompted to attempt answering questions without looking at the answers first to maximize learning.
OOP stands for Object-Oriented Programming. It involves creating objects that contain both data and methods. Classes act as templates for objects and define their attributes and behaviors. Some advantages of OOP include reusability, organization, and reduced repetition of code. Classes contain fields to store data and methods to perform actions on that data. Objects are instances of classes that inherit all fields and methods. Constructors initialize objects and can set initial field values. Arrays can store multiple objects. Dynamic arrays allow adding elements at runtime. Partial classes allow splitting a class definition across multiple files.
StxNext Lightning Talks - Feb 12, 2016
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice when it comes to Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and on the other - keeping short compile times.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up an Android-kotlin project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin usage is presented and the language is compared to SCALA and SWIFT.
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
Kotlin - one of the popular programming languages built on top of Java that runs on JVM. Thanks to JetBrains support and excellent IDE integration, it’s an ideal choice for Android development. 100% Java compatibility, interoperability and no runtime overhead is just the beginning of a long list of strengths. Kotlin is supposed to be a subset of SCALA, on one hand covering major advantages for developers and keeping short compile times on the other.
This presentation is a Developer Starter - a set of hand-picked information allowing a person with no knowledge of Kotlin to start writing basic Android activities and set up a kotlin-based Android project. It starts with language background, reasons for its creation and advantages. Then presents basic use cases, syntax, structures and patterns. Later on Kotlin is presented in Android context. Simple project structure, imports and Kotlin usage with Android SDK is explained. In the end cost of Kotlin compilation is presented and the language is compared to SCALA and SWIFT.
In this chapter we will discuss one recommended practice for efficiently solving computer programming problems and make a demonstration with appropriate examples. We will discuss the basic engineering principles of problem solving, why we should follow them when solving computer programming problems (the same principles can also be applied to find the solutions of many mathematical and scientific problems as well) and we will make an example of their use. We will describe the steps, in which we should go in order to solve some sample problems and show the mistakes that can occur when we do not follow these same steps. We will pay attention to some important steps from the methodology of problem solving, that we usually skip, e.g. the testing. We hope to be able to prove you, with proper examples, that the solving of computer programming problems has a "recipe" and it is very useful.
In this chapter we review the basic rules and recommendations for writing quality program code. We pay attention to naming the identifiers in the program (variables, methods, parameters, classes, etc.), formatting and code organization rules, good practices for composing methods, and principles for writing quality documentation.
This document discusses polymorphism, abstract classes, and abstract methods. It defines polymorphism as an object's ability to take on many forms and describes how it allows reference variables to refer to objects of child classes. It also distinguishes between method overloading and overriding, and explains the rules for each. Abstract classes are introduced as classes that cannot be instantiated directly but can be inherited from, and it is noted they may or may not contain abstract methods.
Encapsulation provides benefits such as reducing complexity, ensuring structural changes remain local, and allowing for validation and data binding. It works by hiding implementation details and wrapping code and data together. Objects use private fields and public getters/setters for access. Access modifiers like private, protected, and public control visibility. Validation occurs in setters through exceptions. Mutable objects can be modified after creation while immutable objects cannot. The final keyword prevents inheritance, method overriding, or variable reassignment.
The document discusses various concepts related to abstraction in software development including project architecture, code refactoring, enumerations, and the static keyword in Java. It describes how to split code into logical parts using methods and classes to improve readability, reuse code, and avoid repetition. Refactoring techniques like extracting methods and classes are presented to restructure code without changing behavior. Enumerations are covered as a way to represent numeric values from a fixed set as text. The static keyword is explained for use with classes, variables, methods, and blocks to belong to the class rather than object instances.
19. Java data structures algorithms and complexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use.
In this chapter we will explore strings. We are going to explain how they are implemented in Java and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions.
In this chapter we will discuss exceptions in the object-oriented programming and in Java in particular. We will learn how to handle exceptions using the try-catch construct, how to pass them to the calling methods and how to throw standard or our own exceptions using the throw construct.
Here we are going to take a look how to use for loop, foreach loop and while loop. Also we are going to learn how to use and invoke methods and how to define classes in Java programming language.
This document provides an overview of Java collections basics, including arrays, lists, strings, sets, and maps. It defines each type of collection and provides examples of how to use them. Arrays allow storing fixed-length sequences of elements and can be accessed by index. Lists are like resizable arrays that allow adding, removing and inserting elements using the ArrayList class. Strings represent character sequences and provide various methods for manipulation and comparison. Sets store unique elements using HashSet or TreeSet. Maps store key-value pairs using HashMap or TreeMap.
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
The document discusses Java syntax and concepts including:
1. It introduces primitive data types in Java like int, float, boolean and String.
2. It covers variables, operators, and expressions - how they are used to store and manipulate data in Java.
3. It explains console input and output using Scanner and System.out methods for reading user input and printing output.
4. It provides examples of using conditional statements like if and if-else to control program flow based on conditions.
In this chapter we will get familiar with primitive types and variables in Java – what they are and how to work with them. First we will consider the data types – integer types, real types with floating-point, Boolean, character, string and object type. We will continue with the variables, with their characteristics, how to declare them, how they are assigned a value and what is variable initialization.
01. Introduction to programming with javaIntro C# Book
In this chapter we will take a look at the basic programming terminology and we will write our first Java program. We will familiarize ourselves with programming – what it means and its connection to computers and programming languages.
In this chapter we will discuss one recommended practice for efficiently solving computer programming problems and make a demonstration with appropriate examples. We will discuss the basic engineering principles of problem solving, why we should follow them when solving computer programming problems (the same principles can also be applied to find the solutions of many mathematical and scientific problems as well) and we will make an example of their use. We will describe the steps, in which we should go in order to solve some sample problems and show the mistakes that can occur when we do not follow these same steps. We will pay attention to some important steps from the methodology of problem solving, that we usually skip, e.g. the testing. We hope to be able to prove you, with proper examples, that the solving of computer programming problems has a "recipe" and it is very useful
Chapter 22. Lambda Expressions and LINQIntro C# Book
In this chapter we will become acquainted with some of the advanced capabilities of the C# language. To be more specific, we will pay attention on how to make queries to collections, using lambda expressions and LINQ, and how to add functionality to already created classes, using extension methods. We will get to know the anonymous types, describe their usage briefly and discuss lambda expressions and show in practice how most of the built-in lambda functions work. Afterwards, we will pay more attention to the LINQ syntax – we will learn what it is, how it works and what queries we can build with it. In the end, we will get to know the meaning of the keywords in LINQ, and demonstrate their capabilities with lots of examples.
In this chapter we review the basic rules and recommendations for writing quality program code. We pay attention to naming the identifiers in the program (variables, methods, parameters, classes, etc.), formatting and code organization rules, good practices for composing methods, and principles for writing quality documentation. We describe the official "Design Guidelines for Developing Class Libraries for .NET" from Microsoft. In the meantime we explain how the programming environment can automate operations such as code formatting and refactoring.
This chapter is a kind of continuation of the previous one – “Object-Oriented Programming Principles”. The reader is expected to be familiar with the basic OOP principles: abstraction, inheritance, polymorphism, encapsulation and exception handling. Those do greatly affect the quality of the code.
19. Data Structures and Algorithm ComplexityIntro C# Book
In this chapter we will compare the data structures we have learned so far by the performance (execution speed) of the basic operations (addition, search, deletion, etc.). We will give specific tips in what situations what data structures to use. We will explain how to choose between data structures like hash-tables, arrays, dynamic arrays and sets implemented by hash-tables or balanced trees. Almost all of these structures are implemented as part of NET Framework, so to be able to write efficient and reliable code we have to learn to apply the most appropriate structures for each situation.
This document provides an overview of dictionaries, hash tables, and sets. It discusses the dictionary abstract data type and how it can be implemented using hash tables. It covers hashing, collision resolution strategies, and the .NET Dictionary<TKey, TValue> class. It also discusses sets and the HashSet<T> and SortedSet<T> classes, comparing their time complexities.
In this chapter we are going to get familiar with some of the basic presentations of data in programming: lists and linear data structures. Very often in order to solve a given problem we need to work with a sequence of elements. For example, to read completely this book we have to read sequentially each page, i.e. to traverse sequentially each of the elements of the set of the pages in the book. Depending on the task, we have to apply different operations on this set of data. In this chapter we will introduce the concept of abstract data types (ADT) and will explain how a certain ADT can have multiple different implementations. After that we shall explore how and when to use lists and their implementations (linked list, doubly-linked list and array-list). We are going to see how for a given task one structure may be more convenient than another. We are going to consider the structures "stack" and "queue", as well as their applications. We are going to get familiar with some implementations of these structures.
This document provides an overview of trees and tree-like data structures. It discusses trees and related terminology like nodes, edges, and traversals. It also covers implementing trees recursively and with a Tree<T> class. Binary trees and different traversal orders are explained. Balanced search trees like AVL trees, red-black trees, and B-trees are introduced for maintaining search trees in a balanced way. Finally, graphs are defined as a set of nodes connected by edges.
What to Expect When Hiring Shopify Development Services_ A Technical Walkthro...CartCoders
Get custom Shopify development services tailored to your store’s needs. From theme setup to full-scale integrations, our Shopify experts help create reliable, fast-loading, and conversion-focused online stores that fit your brand and drive more sales.
Darley - BSides Nairobi (2025-06-07) Epochalypse 2038 - Time is Not on Our Si...treyka
Epochalypse 2038: Time is Not on Our Side
Presented by Trey Darley, Founder – Threshold Continuity Alliance
BSides Nairobi – 2025-06-07
The Year 2038 Problem is real — and it's already here.
At exactly 03:14:07 UTC on January 19, 2038, 32-bit signed Unix time overflows. Systems that use 32-bit time_t will reset to 1901 and/or fail outright. But this isn’t just about old embedded gear. It’s about trust, cryptographic integrity, log coherence, financial timestamps, system coordination, and the fragile scaffolding of global infrastructure.
This talk explores a dangerous and still largely invisible class of vulnerabilities: timestamp fragility and time synchronization failure.
We cover:
- Why over 60% of global software systems still depend on Unix epoch time
- How 2038 bugs can manifest subtly — without a crash, and without warning
- Why critical infrastructure (energy, telecom, aviation, finance) is especially at risk
- How even modern firmware is being shipped today with latent Y2038 bugs
- The implications for TLS certificates, forensic timelines, billing systems, and safety-critical protocols
- How time can be maliciously spoofed, delayed, or misaligned — and why legacy NTP is often unauthenticated
- A pragmatic call for 2038 rollover testbeds, code audits, and hardened time infrastructure
- Recommendations for deploying secure time protocols (NTS, RFC 8915), GPS + Rubidium/Cesium fallback, and air-gapped sync
You’ll leave with a grounded understanding of:
- Why time isn’t just an input — it’s an untrusted vector
- What engineers, regulators, and defenders must do now to avert a long-tail catastrophe
- How underserved regions may suffer disproportionately — but also leap ahead by refusing to inherit broken time
About the Speaker
Trey Darley is the founder of the Threshold Continuity Alliance (TCA), an initiative focused on strategic risk, infrastructure integrity, and time-based vulnerability remediation. A long-time figure in the global cybersecurity community, Trey works at the intersection of symbolic systems, resilience engineering, and future ethics.
Predicting Site Quality Google Patent US9767157B2 - Behzad Hussain.pdfBehzad Hussain
𝐏𝐚𝐭𝐞𝐧𝐭 𝐈𝐧𝐟𝐨𝐫𝐦𝐚𝐭𝐢𝐨𝐧
𝗣𝗮𝘁𝗲𝗻𝘁 𝗡𝗼.: US9767157B2
𝗧𝗶𝘁𝗹𝗲: Predicting Site Quality
𝗔𝘀𝘀𝗶𝗴𝗻𝗲𝗲: Google Inc., Mountain View, CA
𝗜𝗻𝘃𝗲𝗻𝘁𝗼𝗿𝘀: Navneet Panda; Yun Zhou
𝗜𝘀𝘀𝘂𝗲 𝗗𝗮𝘁𝗲: September 19, 2017
𝐀𝐛𝐬𝐭𝐫𝐚𝐜𝐭
This patent describes methods and systems for automatically predicting a quality score for a website (or “site”) that can be used as a ranking signal in search engines:
1. 𝗕𝗮𝘀𝗲𝗹𝗶𝗻𝗲 𝘀𝗶𝘁𝗲 𝗾𝘂𝗮𝗹𝗶𝘁𝘆 𝘀𝗰𝗼𝗿𝗲𝘀 obtained for previously scored sites.
2. 𝗣𝗵𝗿𝗮𝘀𝗲 𝗺𝗼𝗱𝗲𝗹𝘀 that map phrase-specific relative frequency measures to baseline quality scores.
3. 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗲 𝘀𝗰𝗼𝗿𝗶𝗻𝗴 of a new site by applying the phrase model to its phrase frequencies and then predicting its overall site quality score from the aggregate.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞 (𝐅𝐢𝐠. 𝟏)
1. 𝗨𝘀𝗲𝗿 𝗗𝗲𝘃𝗶𝗰𝗲 & 𝗡𝗲𝘁𝘄𝗼𝗿𝗸: Users submit queries via a device (e.g., browser) over a network.
2. 𝗦𝗲𝗮𝗿𝗰𝗵 𝗦𝘆𝘀𝘁𝗲𝗺: Contains an Indexing Engine (builds the index database) and a Ranking Engine (ranks results).
3. 𝗦𝗶𝘁𝗲 𝗦𝗰𝗼𝗿𝗶𝗻𝗴 𝗘𝗻𝗴𝗶𝗻𝗲: Computes site quality scores using the phrase model and provides these scores to the ranking engine as part of the ranking signals.
𝐏𝐡𝐫𝐚𝐬𝐞 𝐌𝐨𝐝𝐞𝐥 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧 (𝐅𝐢𝐠. 𝟐)
1. 𝗧𝗼𝗸𝗲𝗻𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝗮𝗻𝗱 𝗻-𝗴𝗿𝗮𝗺 𝗘𝘅𝘁𝗿𝗮𝗰𝘁𝗶𝗼𝗻: For each site in a corpus of previously scored sites, extract n-grams (typically 2- to 5-grams) from page content.
2. 𝗥𝗲𝗹𝗮𝘁𝗶𝘃𝗲 𝗙𝗿𝗲𝗾𝘂𝗲𝗻𝗰𝘆 𝗖𝗮𝗹𝗰𝘂𝗹𝗮𝘁𝗶𝗼𝗻: For each extracted n-gram, compute its relative frequency as the ratio of pages containing that n-gram to total pages on the site.
3. 𝗕𝘂𝗰𝗸𝗲𝘁 𝗣𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴: Group sites into 20–100 buckets based on their relative frequency measures for each n-gram, ensuring roughly equal bucket sizes or equal interval ranges.
4. 𝗕𝗮𝘀𝗲𝗹𝗶𝗻𝗲 𝗦𝗰𝗼𝗿𝗲 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗶𝗼𝗻: For each bucket, calculate an average baseline quality score from the known scores of sites in that bucket.
5. 𝗣𝗵𝗿𝗮𝘀𝗲 𝗠𝗼𝗱𝗲𝗹 𝗖𝗼𝗻𝘀𝘁𝗿𝘂𝗰𝘁𝗶𝗼𝗻: Associate each n-gram with its vector of bucket-average quality scores. Optionally exclude “neutral” phrases whose scores are statistically indistinguishable from the global average.
𝐒𝐢𝐭𝐞 𝐐𝐮𝐚𝐥𝐢𝐭𝐲 𝐏𝐫𝐞𝐝𝐢𝐜𝐭𝐢𝐨𝐧 𝐏𝐫𝐨𝐜𝐞𝐬𝐬 (𝐅𝐢𝐠. 𝟑)
1. 𝗥𝗲𝗹𝗮𝘁𝗶𝘃𝗲 𝗙𝗿𝗲𝗾𝘂𝗲𝗻𝗰𝘆 𝗳𝗼𝗿 𝗡𝗲𝘄 𝗦𝗶𝘁𝗲: Extract the same set of n-grams from the new (previously unscored) site and compute their relative frequencies.
2. 𝗕𝘂𝗰𝗸𝗲𝘁 𝗟𝗼𝗼𝗸𝘂𝗽: For each phrase, map its relative frequency to the corresponding bucket’s average score in the phrase model.
3. 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗲 𝗦𝗰𝗼𝗿𝗲 𝗖𝗼𝗺𝗽𝘂𝘁𝗮𝘁𝗶𝗼𝗻: Compute an aggregate score across all phrases’ bucket scores—typically via a weighted or unweighted mean. Weights can reflect phrase frequency, distance from a “neutral” score, or limit the influence of overly frequent phrases.
挂科无法毕业鉴于此购买文凭【q薇1954292140】一比一原版(UoN毕业证)北安普顿大学毕业证如何办理改成绩单GPA,文凭购买,毕业证办理,文凭办理只是基础业务。【q薇1954292140】一比一还原国外大学毕业证,定制国外大学学历,制作国外大学文凭,复刻国外大学毕业证书。学位证1:1完美还原海外各大学毕业材料上的工艺:水印,阴影底纹,钢印LOGO烫金烫银,LOGO烫金烫银复合重叠。文字图案浮雕、激光镭射、紫外荧光、温感、复印防伪等防伪工艺。
【办理北安普顿大学成绩单Buy The University of Northampton Transcripts】
购买日韩成绩单、英国大学成绩单、美国大学成绩单、澳洲大学成绩单、加拿大大学成绩单(q微1954292140)新加坡大学成绩单、新西兰大学成绩单、爱尔兰成绩单、西班牙成绩单、德国成绩单。成绩单的意义主要体现在证明学习能力、评估学术背景、展示综合素质、提高录取率,以及是作为留信认证申请材料的一部分。
北安普顿大学成绩单能够体现您的的学习能力,包括北安普顿大学课程成绩、专业能力、研究能力。(q微1954292140)具体来说,成绩报告单通常包含学生的学习技能与习惯、各科成绩以及老师评语等部分,因此,成绩单不仅是学生学术能力的证明,也是评估学生是否适合某个教育项目的重要依据!
Buy The University of Northampton Diploma《正式成绩单论文没过》有文凭却得不到认证。又该怎么办?鉴于此,购买英国毕业证【q微1954292140】英国文凭购买,英国文凭购买,英国文凭定制,英国文凭补办。专业在线定制英国大学文凭,定做英国本科文凭,【q微1954292140】复制英国The University of Northampton completion letter。在线快速补办英国本科毕业证、硕士文凭证书,购买英国学位证、北安普顿大学Offer,英国大学文凭在线购买。
【主营项目】
一、工作未确定,回国需先给父母、亲戚朋友看下文凭的情况,办理毕业证|办理北安普顿大学毕业证(UoN毕业证书)文凭: 买大学毕业证|买大学文凭【q薇1954292140】学位证明书如何办理申请?
二、回国进私企、外企、自己做生意的情况,这些单位是不查询毕业证真伪的,而且国内没有渠道去查询国外文凭的真假,也不需要提供真实教育部认证。鉴于此,办理北安普顿大学毕业证【q薇1954292140】英国学位证(UoN毕业证书)北安普顿大学毕业证书如何办理国外大学毕业证, 文凭办理, 国外文凭办理, 留信网认证
三.材料咨询办理、认证咨询办理北安普顿大学毕业证(UoN毕业证书)请加学历顾问【微信:1954292140】毕业证购买指大学文凭购买,毕业证办理和文凭办理。学院文凭定制,学校原版文凭补办,扫描件文凭定做,100%文凭复刻。经常操作的国家有美国毕业证,英国毕业证,澳洲毕业证,加拿大毕业证,以及德国毕业证,法国毕业证、荷兰毕业证、瑞士毕业证、日本毕业证、韩国毕业证、新西兰毕业证、新加坡毕业证、泰国毕业证、马来西亚毕业证等。包括了本科毕业证,硕士毕业证。
On Dec. 4, 1963, the Second Vatican Council solemnly approved its first two documents: the constitution on the Sacred Liturgy, Sacrosanctum Concilium, and the decree Inter Mirifica, regarding the mass media. The latter document is much less known than the former one.
Nonetheless, Inter Mirifica offers some crucial principles to guide us in a world where we find ourselves ever more immersed in mass communication: the press, film, television, along with the newer forms of media.
During the preparation for Vatican II, the Church keenly realized the importance of this topic, and Pope John XXIII established a special body to work on a text that might articulate the Church’s teaching on the mass media and promote her action in this area. The result of this work was an extensive document, entitled “On the instruments of social communication,” which was presented to the Council on Nov. 23, 1962.
Internet & Protocols : A Blueprint of the Internet Systemcpnabil59
Internet & Protocols: A Blueprint of the Internet System by Nabil Bin Billal is a comprehensive and ambitious guide that unravels the complexity of how the internet works—layer by layer, protocol by protocol, and service by service. This book is designed not just for students or developers, but for anyone curious about the inner structure and functionality of the digital world we depend on every day. Whether you're a beginner hoping to build foundational knowledge or a curious reader aiming to explore deeper layers of internet architecture, this book serves as a solid blueprint.
From the basics of the internet and its protocols to the intricate systems behind servers, databases, hosting, and DNS, the book journeys through every major layer of online connectivity. It explores technologies like TCP/IP, HTTP, DNS, and modern URL systems, helping readers understand how a simple web address leads to a complex interaction between multiple systems and services. With examples from real-life websites such as Apple.com, GitHub Pages, and Bidibo.xyz, concepts are explained clearly and practically.
The book delves into backend processes, covering JavaScript-based interactivity, database integration, and dynamic routing. It then transitions into the world of domains and internet governance, introducing readers to ICANN, registrars, DNS root servers, and the fascinating history of domain name systems. It sheds light on the control structure of the internet, discussing why most digital infrastructure is based in the U.S. and how domain registration has evolved from a free service to a billion-dollar industry.
Security plays a central role in the discussion, with detailed chapters on HTTPS, SSL/TLS, browser verification, and data encryption. It also takes a practical look at performance, introducing concepts like caching, CDNs, and load balancing to show how the modern web achieves speed and stability. The deep and dark web chapters provide insight into the vast unexplored parts of the internet, discussing how anonymity tools like Tor work and what lies beyond the surface web.
A standout feature of the book is its treatment of search engines—both traditional and dark web variants—explaining crawling, indexing, noindex tags, ranking algorithms, and SEO basics. It demystifies how websites appear in Google search results and how metadata plays a key role. Readers are also introduced to the real-time internet, with chapters on IoT, cloud computing, NASA’s deep space networks, Wi-Fi, Bluetooth, Ethernet, and data transmission protocols. Detailed discussions cover IEEE standards, spectrum ranges, SIM card technology, mobile towers, and the very mechanics of electromagnetic communication.
3D Graphics means creating images that look real and have depth, height, and width, just like real-life objects. These graphics are made using special software and help to make things look more realistic and detailed in games, movies, design, and much more.
Cloud Computing – iCloud
Cloud computing is a modern technology that allows users to store and access data over the internet instead of using local storage devices. One of the most popular cloud services is Apple's iCloud, which is specially designed for Apple users.
iCloud helps users keep their data safe, accessible, and synchronized across all Apple devices like iPhones, iPads, and MacBooks. It is simple to use, secure, and saves time by automatically backing up important information.
3 years of Quarkus in production, what have we learned - Devoxx PolenJago de Vreede
Quarkus has grown in popularity in the last years, but what’s it really like to use it in large-scale, real-world business projects? In this session, we’ll move beyond the basics of "Hello World" to explore how to build enterprise-level applications with Quarkus efficiently.
In this talk we will set up a multi-module project, incorporating integration tests and addressing the challenges with build times, while maintaining a high development velocity. Next, we’ll tackle an upgrade scenario and splitting the application into multiple microservices. Along the way, we’ll share hard-earned lessons, including what to avoid.
At the end of the talk, you should have a good understanding of how to efficiently set up a “big” enterprise project with Quarkus and the confidence to get started.
CBUSDAW - Ash Lewis - Reducing LLM HallucinationsJason Packer
11. Java Objects and classes
1. Using Objects and Classes
Defining Simple Classes
Objects and Classes
Software University
http://softuni.bg
SoftUni Team
Technical Trainers
2. Table of Contents
1. Objects
2. Classes
3. Built in Classes
4. Defining Simple Classes
Fields
Constructors
Methods
5. Objects
An object holds a set of named values
E.g. birthday object holds day, month and year
Creating a birthday object:
5
Birthday
day = 27
month = 11
year = 1996
LocalDate birthday =
LocalDate.of(2018, 5, 5);
System.out.println(birthday);
Create a new object of
type LocalDate
Object
fields
Object
name
6. Classes
In programming classes provide the structure for objects
Act as a blueprint for objects of the same type
Classes define:
Fields (private variables), e.g. day, month, year
Getters/Setters, e.g. getDay, setMonth, getYear
Actions (behavior), e.g. plusDays(count),
subtract(date)
Typically a class has multiple instances (objects)
Sample class: LocalDate
Sample objects: birthdayPeter, birthdayMaria
6
7. Objects - Instances of Classes
Creating the object of a defined class is
called instantiation
The instance is the object itself, which is
created runtime
All instances have common behaviour
7
LocalDate date1 = LocalDate.of(2018, 5, 5);
LocalDate date2 = LocalDate.of(2016, 3, 5);
LocalDate date3 = LocalDate.of(2013, 3, 2);
8. Classes vs. Objects
Classes provide structure for
creating objects
An object is a single
instance of a class
8
class
LocalDate
day: int
month: int
year: int
plusDays(…)
minusDays(…)
Class actions
(methods)
Class name
Class fields
object
birthdayPeter
day = 27
month = 11
year = 1996
Object
name
Object
data
10. Java provides ready-to-use classes:
Organized inside Packages like:
java.util.Scanner, java.utils.List, etc.
Using static class members:
Using non-static Java classes:
Built-In API Classes in Java
10
LocalDateTime today = LocalDateTime.now();
double cosine = Math.cos(Math.PI);
Random rnd = new Random();
int randomNumber = rnd.nextInt(99);
11. You are given a list of words
Randomize their order and print each word on a separate line
Problem: Randomize Words
11Check your solution here: https://judge.softuni.bg/Contests/1319/
Note: the output is a sample.
It should always be different!
a b
b
a
PHP Java C#
Java
PHP
C#
12. Solution: Randomize Words
12
Scanner sc = new Scanner(System.in);
String[] words = sc.nextLine().split(" ");
Random rnd = new Random();
for (int pos1 = 0; pos1 < words.length; pos1++) {
int pos2 = rnd.nextInt(words.length);
//TODO: Swap words[pos1] with words[pos2]
}
System.out.println(String.join(
System.lineSeparator(), words));
Check your solution here: https://judge.softuni.bg/Contests/1319/
13. Calculate n! (n factorial) for very big n (e.g. 1000)
Problem: Big Factorial
13
50
3041409320171337804361260816606476884437764156
8960512000000000000
5 120 10 3628800 12 479001600
88
1854826422573984391147968456455462843802209689
4939934668442158098688956218402819931910014124
4804501828416633516851200000000000000000000
Check your solution here: https://judge.softuni.bg/Contests/1319/
14. Solution: Big Factorial
14
import java.math.BigInteger;
...
int n = Integer.parseInt(sc.nextLine());
BigInteger f = new BigInteger(String.valueOf(1));
for (int i = 1; i <= n; i++) {
f = f.multiply(BigInteger
.valueOf(Integer.parseInt(String.valueOf(i))));
}
System.out.println(f);
Use the
java.math.BigInteger
N!
Check your solution here: https://judge.softuni.bg/Contests/1319/
16. Specification of a given type of objects
from the real-world
Classes provide structure for describing
and creating objects
Defining Simple Classes
16
class Dice {
…
}
Class name
Class body
Keyword
17. Naming Classes
Use PascalCase naming
Use descriptive nouns
Avoid abbreviations (except widely known, e.g. URL,
HTTP, etc.)
17
class Dice { … }
class BankAccount { … }
class IntegerCalculator { … }
class TPMF { … }
class bankaccount { … }
class intcalc { … }
18. Class is made up of state and behavior
Fields store values
Methods describe behaviour
Class Members
18
class Dice {
private int sides;
public void roll() { … }
}
Field
Method
19. Store executable code (algorithm)
Methods
19
class Dice {
public int sides;
public int roll() {
Random rnd = new Random();
int sides = rnd.nextInt(this.sides + 1);
return sides;
}
}
20. Getters and Setters
20
class Dice {
. . .
public int getSides() { return this.sides; }
public void setSides(int sides) {
this.sides = sides;
}
public String getType() { return this.type; }
public void setType(String type) {
this.type = type;
}
}
Getters & Setters
21. A class can have many instances (objects)
Creating an Object
21
class Program {
public static void main(String[] args) {
Dice diceD6 = new Dice();
Dice diceD8 = new Dice();
}
}
Use the new
keyword
Variable stores a
reference
22. Special methods, executed during object creation
Constructors
22
class Dice {
public int sides;
public Dice() {
this.sides = 6;
}
}
Overloading default
constructor
Constructor name is
the same as the name
of the class
23. You can have multiple constructors in the same class
Constructors (2)
23
class Dice {
public int sides;
public Dice() { }
public Dice(int sides) {
this.sides = sides;
}
}
class StartUp {
public static void main(String[] args) {
Dice dice1 = new Dice();
Dice dice2 = new Dice(7);
}
}
24. Read students until you receive "end" in the following format:
"{firstName} {lastName} {age} {hometown}"
Define a class Student, which holds the needed information
If you receive a student which already exists (matching
firstName and lastName), overwrite the information
After the end command, you will receive a city name
Print students which are from the given city in the format:
"{firstName} {lastName} is {age} years old."
Problem: Students
24
25. Solution: Students (1)
25
public Student(String firstName, String lastName,
int age, String city){
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.city = city;
// TODO: Implement Getters and Setters
}
26. Solution: Students (2)
26
List<Student> students = new ArrayList<>();
String line;
while (!line.equals("end")) {
// TODO: Extract firstName, lastName, age, city from the input
Student existingStudent = getStudent(students, firstName, lastName);
if(existingStudent != null) {
existingStudent.setAge(age);
existingStudent.setCity(city);
} else {
Student student = new Student(firstName, lastName, age, city);
students.add(student);
}
line = sc.nextLine();
}
29. …
…
…
Summary
Classes define templates for object
Fields
Constructors
Methods
Objects
Hold a set of named values
Instance of a class