4. Java Netbeans Helsinki Uni MOOC programming 1 part 4 variables

preview_player
Показать описание
Today we explore part 1 section 4 which focuses on understanding what a variable is and how they can be used. We work through the five (Various Variables, Integer Input, Double Input, Boolean Input, & Different Types of Input) exercises in this section and write suitable solutions to pass the exercises. I make a few mistakes, on purpose of course lol.

If you like the video, please give it a thumbs up and subscribe. Thank you & happy coding!

Links
Рекомендации по теме
Комментарии
Автор

i started couple days ago with this course and it really helps me. I have not made mistakes or something yet but its nice to rewatch how experienced people would write the same exercise.

Its really helpful that you summarize the text on this site. As a Non-native speaker its sometimes hard to follow because there are a lot of unknown words that i don't know even after learning 12 years American & British english at school.

Thanks for your Videos :)

WorldCupWinner
Автор

thank you so much Duncan, this is the second video of yours im watching and its really helpful, keep it up!

elian
Автор

For the Integer Input exercise (23:38), I saw you put "int input" under the scanner line instead of within the line of code that had the nextLine() function. Would the alternative below also work? 

Scanner scanner = new Scanner(System.in);

System.out.println("Give a number:");

Int input =

System.out.println("You gave the number " + input);

(I would test this myself but I ran into technical issues installing Netbeans on my Mac, so I've just been following along with you instead lol)

DelicateDaisy
Автор

I am banging my head so hard rn with the bool one. I did the same before the video. Did the video and checked line per line and I'm still getting an error. It's not that I am in the wrong folder either.

oozly
Автор

gettin an error for the different types of input exercise on line 7 for some reason but my code looks exactly like yours.
ComparisonFailure : output on line 7 was incorrect with the input:
Hi
11
4.2
true

Expected:
You gave the double 4.2
Output was:
You have the double 4.2 expected:<You [g]ave the double 4.2> but was:<You [h]ave the double 4.2>

this is my code:
import java.util.Scanner;

public class DifferentTypesOfInput {

public static void main(String[] args) {
Scanner scan = new Scanner(System.in);

System.out.println("Give a string: ");
String strInput = scan.nextLine();

System.out.println("Give an integer: ");
int iInput =

System.out.println("Give a double: ");
double dInput =

System.out.println("Give a boolean: ");
boolean bInput =

System.out.println("You gave the string " + strInput);
System.out.println("You gave the integer " + iInput );
System.out.println("You have the double " + dInput);
System.out.println("You gave the boolean " + bInput);
}
}

jr
welcome to shbcf.ru