The Fermat test is based on a result from number theory known as Fermat’s little theorem.

According to Fermat’s little theorem, if n is a prime number and d is any positive integer less than n, then d raised to the nth power is congruent to d modulo n.

If two numbers have the same remainder when divided by n then they are said to be congruent modulo n. d modulo n is simply the remainder of a number d when divided by n.

For example, 34 is congruent to 16 (modulo 3) as
34 modulo 3 = 1 and…

Have you desired control over the execution context of your multi-threaded environment? Have you encountered challenges emanating from multiple spawned threads not being managed adequately?

One can effectively manage asynchronous computations in a cooperative pattern by adopting coroutines. A coroutine is a method that executes for a certain period, suspends, and permits other coroutines to run. A CoroutineScope binds all the launched coroutines to a CoroutineContext. A CoroutineContext is an indexed type-safe heterogeneous map encompassing CoroutineContext.Key to CoroutineContext.Element pairs.

The ViewModel is always bound to the lifecycle of an activity or a fragment. It aids in storing and managing UI-related…

We frequently encounter code that looks like this:

open class ExampleClass {

private var dependencyOne = DependencyOne()
private lateinit var utilDependency: UtilDependency
protected lateinit var dataProvider: DataProvider

protected open fun loadData() {
dataProvider = DataProvider()
utilDependency = UtilDependency(dataProvider)

In any code, we know one type depends on multiple other types, like ExampleClass depends on dependencyOne, utilDependency, and dataProvider and it resolves these dependencies using a constructor dependencyOne = DependencyOne() or maybe even help resolve dependencies for the type it depends on utilDependency = UtilDependency(dataProvider).

As developers, we often write tests but we don’t want our tests to be…

Majority of the folks in the programming community start with the plain old “Hello World” when experimenting with a new language.

Let’s print “Hello World” in PHP.

echo "Hello World";

Too lazy, use short tags (not recommended):

<?="Hello World"?>

In JavaScript :

console.log("Hello World");

Let’s enter the Java World.

public class DemoClass{  public static void main(String[] args){
System.out.println("Hello World");

Everything in Java has to be enclosed within a class. A class can be any blueprint that describes the states and behaviours of objects. An object is an instance of a class. An object has state and behaviour.

Devesh Shetty

Developer @Shopify

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store