Answer:
Digital Ocean (but you need to set it up first)
Explanation:
If you are a student, I would recommend Digital Ocean, as you get £50 free credit as part of the GitHub Student Pack. (I believe you have to pay in a little bit however). There are also other reputable hosting providers, AWS should do the trick. For people just starting out, I would recommend hosting from their own machine. If you don't want to pay ever, and are just using basic HTML/CSS, you can use GitHub Pages as a means to host websites.
DO / AWS will only provide you with a blank Linux box, it would then be up to you to install suitable website hosting software - such as Apache/Nginx ect...
Answer:
//import Random package
import java.util.Random;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
try{
/* create an object of Random class. this will generate random number
in a given range. */
Random rand = new Random();
// create two variables and assign 100 and 250 to
int l = 100;
int h = 250;
//generate the random number between 100 & 250 (inclusive)
int ran_num = rand.nextInt((h+1)-l) + l;
System.out.println("random number is: "+ran_num);
}catch(Exception ex){
return;}
}
}
Explanation:
Import "import java.util.Random" package.In this package, Random class exist. With the help of this class's object, we can generate a random number between a given range.Here we have to generate a random number between 100 to 250(inclusive). So "(h+1)-l" will be 151 and the number generate is in the range of 0-150. if we add 100 to it, then random number will be in range of 100 to 250.
Output:
random number is: 158
Answer:
// here is the complete code in java to check the output.
import java.util.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
try{
int x=20,y=10;
System.out.println( x + "\t" + y );
swap( x, y );
System.out.println( x + "\t" + y );
}catch(Exception ex){
return;}
}
public static void swap( int a, int b )
{
if( a > b )
{
int temp = b;
b = a;
a = temp;
}
System.out.println( a + "\t" + b );
}
}
Explanation:
Here is "x" is initialize with 20 and "y" is with 10. The first print statement will print the value of "x" and "y" separated by a tab. Then it will the swap() method with parameter x and y.In the swap method, if first parameter is greater then it will swap the two value and the print statement will execute. It will print 10 and 20 separated by a tab. then in the main method, print statement execute And print the value of x,y as 20 and 10. Here value of x, y will not change by the method swap() because in java parameters are passed by value not by reference.That is why any change by swap() method will not reflect in the main method.
Output:
20 10
10 20
20 10