Skip to content

Instantly share code, notes, and snippets.

tomcat
start tomcat 9 manually
C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin
Tomcat9w -> start
checker - netstat -aon |find /i "listening" |find "8080"
killer - taskkill /F /P
@ilialloyd
ilialloyd / gist:8cb1fbaf86d3d1e62c7847e88bf49143
Last active October 25, 2022 04:04
First And Last Digit Sum
public static int sumFirstAndLastDigit(int number) {
int lastDigit;
int sum = 0;
if(number<0){
return -1;
}
lastDigit = number % 10;
while (number > 9) {//this will give us last digit
@ilialloyd
ilialloyd / gist:65d6e684830cd9366dc3d058e41df232
Created September 1, 2022 03:08
Coding Exercise 11: Playing Cat
public class PlayingCat {
// write your code here
public static boolean isCatPlaying(boolean summer, int temperature){
while (summer == false) { //if it is nut summer
if (!(temperature >= 25 && temperature <= 35)) { //setting temperature
return false;
}else {
return true;
}
}
@ilialloyd
ilialloyd / IntEqualityPrinter
Last active September 1, 2022 03:09
Coding Exercise 10: Equality Printer
public class IntEqualityPrinter {
public static void printEqual(int num1, int num2, int num3){
if(num1<0 || num2<0 || num3<0){
System.out.println("Invalid Value");
}else if(num1==num2 && num2==num3){
System.out.println("All numbers are equal");
}else if(num1!=num2 && num1!=num3 && num2!=num3){
System.out.println("All numbers are different");
}else{
@ilialloyd
ilialloyd / Coding Exercise 9: Minutes To Years and Days Calculator
Created September 1, 2022 02:42
Coding Exercise 9: Minutes To Years and Days Calculator
public class MinutesToYearsDaysCalculator {
public static void printYearsAndDays(long minutes){
if (minutes < 0) {
System.out.println("Invalid Value");
}else {
// make to understand process easy, I go step by step
long hour = minutes / 60; //simple find first hours
long day = hour / 24; // then go for days
long year = day / 365; //then find a years
long remaindays= day%365; //then go for remaining days, so, after some years how many days left we will see
@ilialloyd
ilialloyd / 58. method overloading
Last active September 1, 2022 02:21
Tim Buchalka /Udemy
/**
* Create a method called calcFeetAndInchesToCentimetres, it needs to have 2 parameters (feet, inches).
*
* You should validate that the first parameter feet is >= 0
* You should validate that the second parameter inches is >= 0 and <= 12
* return -1 from the method if either of the above is not true.
*
* If the parameters are valid, then calculate how many centimeters comprise the feet and inches passed
* to this method and return that value.
*