

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts
Hy I am using sublimetext3 and whenever i enter a number and press enter "enter second number" should pop up
I get nothing …and it is not functioning as a calculator..i mean it is not adding up anything
enter first number:
23.1
This is what i get…yyyeaaakkkkk
Tip u can also type syso ctrl+space and then enter 🙂
Thank you so much!!! You are a thousands times more understandable than my JAVA AP teacher. I’ll pass because of these vids THX!
WOW! This is a great video tutorial. Absolutely fantastic!
i didnt get all the zeros afterwards im not sure why but this really helped thanks 🙂
I love your vidoes man. Helping me pass my exams. You are more inspering then my teachers! Keep up the good work:D
super perfection
For me it doesnt work with decimal numbers…only whole numbers…can anone help?
what is the difference between public void and public static void
I get this error when I try and run the program: Exception in thread "main" java.lang.IllegalStateException: Scanner closed
at java.util.Scanner.ensureOpen(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at bucky.applesnotfail.main(applesnotfail.java:11)
Here is the program i had:
package bucky;
import java.util.Scanner;
public class applesnotfail {
public static void main(String args[]){
Scanner bucky = new Scanner(System.in);
bucky.close();
double fnum, snum, answer;
System.out.println("Enter first num: ");
fnum = bucky.nextDouble();
System.out.println("Enter second num:");
snum = bucky.nextDouble();
answer = fnum + snum;
System.out.println(answer);
}
}
Please can someone help me in the last tutorial I had a problem running it as well and I think it is because of the import.java.util.Scanner; If I don’t put the package bucky; I get an error as well, same with when I move it to a different line. I don’t know what to do
Finally watching these all in 2017. Back then I was a school kid when these videos were uploaded
This tutorial is almost 8 years old, but still the best one on youtube 🙂
Somehow i unfucked your code without even understanding it https://gyazo.com/01390594fee0f6a6499ace6c775ba4fe
I’m brand new at programming java and I managed to make a better calculator just after watching this. It’s just a couple extra System.Out statements but I think it’s pretty cool I found this out by my self.
package bucky;
import java.util.Scanner;
public class UserInput {
public static void main (String[] args) {
Scanner bucky = new Scanner(System.in);
double fnum, snum, answer;
System.out.println("Enter first Number");
fnum = bucky.nextDouble();
System.out.println("Enter second Number");
snum = bucky.nextDouble();
System.out.print(fnum);
System.out.print(" + ");
System.out.print(snum);
answer = fnum + snum;
System.out.print(" = ");
System.out.println(answer);
bucky.close();
}
}
Really helped me..
Thanks a ton Bro! 🙂
i am having problem with ECLIPSE .. Page for writing is not opening
import java.util.Scanner;
public class PracticeMethod {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter your first Integer: ");
int Fnumber = in.nextInt();
System.out.print("Enter your second Integer: ");
int Snumber = in.nextInt();
int Result = Fnumber + Snumber;
System.out.println(Fnumber +" + "+ Snumber +" = "+ Result);
Result = Fnumber – Snumber;
System.out.println(Fnumber +" – "+ Snumber +" = "+ Result);
Result = Fnumber * Snumber;
System.out.println(Fnumber +" * "+ Snumber +" = "+ Result);
Result = Fnumber / Snumber;
System.out.println(Fnumber +" / "+ Snumber +" = "+ Result);
Result = Fnumber % Snumber;
System.out.println(Fnumber +" % "+ Snumber +" = "+ Result);
copied example to letter didn’t work error on line 5got in to work by adding in private static Scanner bucky; in line 4and check my clock settings and it had the . there and also I tried it with bucky.close(); and didn’t working but my question is why doesn’t this example work if the java language is all the same.
So the .nextDouble() method is saying to print the next variable on the next line? Bit confused on the exactly what the method is defining.
you have no idea how famous you are in my class… God bless you .. litterly the best teacher avaliable online
i learn so much about java programming on my campus but I’m not make that basic calculator before. this video improve my skills
What about the decimal points explanation?
Getting a "Resource leak: ‘scannername’ is never closed
Any fixes for this?
Thanks in advance
This is so old, but seriously, thank you for taking the time to make this. My teacher gives us the information like the import and class, but doesn’t explain it, so I’ve been copy+pasting while not understanding how things work. This is so helpful <3
I love how the views are steadily decreasing with each video lmao
what am I doing wrong?
Enter first number:
34.1
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at novo.apples.main(apples.java:8)
package PoopPackage1;
//[Made by Nic];
import java.util.Scanner;
import java.util.*;
public class Swqdfqewfqef {
public static final double number = 23.4333111;
private String name;
private int weight;
private boolean hasOwner = false;
private byte age;
private long uniqueID;
private char favoriteChar;
private double speed;
private float height;
protected static int numberOfAnimals = 0;
static Scanner userInput = new Scanner(System.in);
public Swqdfqewfqef() {
numberOfAnimals++;
int sumOfNumbers = 5 – 1;
System.out.println("5 – 1 = " + sumOfNumbers);
int diffOfNumbers = 5 + 1;
System.out.println("5 + 1 = " + diffOfNumbers);
int multOfNumbers = 5 * 1;
System.out.println("5 * 1 = " + multOfNumbers);
int divOfNumbers = 5 / 1;
System.out.println("5 / 1 = " + divOfNumbers);
int modOfNumbers = 5 % 3;
System.out.println("5 % 3 = " + modOfNumbers);
System.out.println("Enter the name: n");
//hasNextInt, hasNextFloat, hasNextDouble
//hasNextByte
//nextInt, nextFloat, nextdouble
if(userInput.hasNextLine()){
this.setName(userInput.nextLine());
}
this.setFavoriteColor();
this.setUniqueID();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public boolean isHasOwner() {
return hasOwner;
}
public void setHasOwner(boolean hasOwner) {
this.hasOwner = hasOwner;
}
public byte getAge() {
return age;
}
public void setAge(byte age) {
this.age = age;
}
public long getUniqueID() {
return uniqueID;
}
public void setUniqueID(long uniqueID) {
this.uniqueID = uniqueID;
System.out.println("Unique ID set tp: " + this.uniqueID);
}
public void setUniqueID() {
long minNumber = 1;
long maxNumber = 1000000;
this.uniqueID = minNumber + (long) (Math.random() *((maxNumber – minNumber) + 1));
String stringNumber = Long.toString(maxNumber);
int numberString = Integer.parseInt(stringNumber);
System.out.println("Unique ID set tp: " + this.uniqueID);
}
public char getFavoriteChar() {
return favoriteChar;
}
public void setFavoriteChar(char favoriteChar) {
this.favoriteChar = favoriteChar;
}
public void setFavoriteChar() {
int randomNumber = (int) (Math.random() * 126) + 1;
this.favoriteChar = (char) randomNumber;
if(randomNumber == 32){
System.out.println("Favorite character set to Space");
}else if(randomNumber == 10){
System.out.println("Favorite character set to Newline");
}else {
System.out.println("Favorite character set to " + this.FavoriteChar);
}
if((randomNumber > 97) && (randomNumber < 122)){
System.out.println("Favorite character is a lowercase letter");
}
System.out.println("Favorite character is a lowercase");
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public static void main(String[] args){
Swqdfqewfqef theSwqdfqewfqef = new Swqdfqewfqef();
}
}
thanks man! this tutorial is beginning to be useful to make things, obviously the first couple of video’s are kinda basic but now its beginning to be interesting!! love it
Everytime when i enter a double it gives me this error:
"
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at me.bryan.javatest.Bryan.calc(Bryan.java:16)
at me.bryan.javatest.Main.main(Main.java:8)
"
When i input an integer the calculator works fine.
This is my code:
"
public void calc() {
Scanner input = new Scanner(System.in);
//
double numOne;
double numTwo;
double answer;
//
System.out.print("Enter your first number: ");
numOne = input.nextDouble();
//
System.out.print("Enter your second number: ");
numTwo = input.nextDouble();
//
answer = numOne + numTwo;
System.out.println("Your final answer is: " + answer);
}
}
"
Friends If you want to make a simple calculator using java IDE Netbeans … The difference between this tutorial and my tutorial is … this is console based calculator … i’ve shared a calculator in GUI … My channel name is tips & tricks…. Thanks
import java.io.IOException;
import java.util.Scanner;
public class Claculator {
public static void main(String[] args) throws IOException{
char choice;
Scanner comu = new Scanner(System.in);
double first,second,answer;
System.out.println("Enter First Number " );
first = comu.nextDouble();
System.out.println("Enter Second Number");
second= comu.nextDouble();
System.out.println("please enter what operation you’d like");
System.out.println("1. ADD ");
System.out.println("2. SUBTRACT");
System.out.println("3. MULTIPLY");
System.out.println("4. DIVIDE");
System.out.println("5. GET REMAINDER");
choice = (char) System.in.read();
switch (choice){
case ‘1’:
answer = first+second;
System.out.println(answer);
break;
case’2′:
answer = first-second;
System.out.println(answer);
break;
case’3′:
answer = first*second;
System.out.println(answer);
break;
case ‘4’:
answer = first/second;
System.out.println(answer);
case ‘5’:
answer = first%second;
System.out.println(answer);
break;
}
}
}
you are obsessed with the name bucky 🙂
what if you wanted to add a menu for that program how would you?
Why are the views lower every video? People getting scared and leaving the want to code java?
thanks you saved me
Yeah, lol, i learned to make a simple calcularot in java ! 🙂
I am several tutorials farther but are there some practices I can do to help me memorize all of this stuff?
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at Test.Test.main(Test.java:8)
play the video at half speed…hilarious.
Who would didlil this ? like wtf
Great & Super Bro !! 😀
when i add the subtract,devide and multiply options so the all the answer cames at oce when add two variable it adds the subtract them ad devide them how to do them seprately
YOU’RE A LIFE SAVER. THANK YOU. I’M ACTUALLY UNDERSTANDING THIS. MY PROFESSOR IS ASIAN & I CAN’T UNDERSTAND HARDLY ANYTHING SHE SAYS WHICH MAKES MY PROGRAMMING 1 CLASS SO DIFFICULT BECAUSE I’M A BEGINNER. GOD BLESS YOU. I HAVE BEEN DELIVERT !!!!!
import java.util.Scanner;
class apples{
public static void main (String args[]){
Scanner bucky = new Scanner (System.in);
double fnum, snum, answer;
System.out.println("Enter first num:");
fnum = bucky.nextDouble();
System.out.println("Enter second num:");
snum = bucky.nextDouble();
answer = fnum + snum;
System.out.println (answer);
}
}
wow this is so much easier in c++
Error: Main method not found in class apples, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
iam getting this message and i copied the whole code correct :/
somebody help? 🙂
you are a great Teacher
This seems like something you could use to make one of those early text-based RPGs.
Which software do you use for coding? ….. Cuz i ve got BlueJ.