Code Monkey home page Code Monkey logo

learning-java-2825378's Issues

why this error come from cmd

sublime

public class helloWorld{

public static void main(string[] args){
	system.out.println("hello world! It's me malitha!");

  

}

}

cmd ,

C:\Users\user\Desktop\linkedin\java\java>javac helloWorld.java
helloWorld.java:3: error: cannot find symbol
public static void main(string[] args){
^
symbol: class string
location: class helloWorld
helloWorld.java:4: error: package system does not exist
system.out.println("hello world! It's me malitha!");
^
2 errors

learning-java-2825378-03_07b (Code gives incorrect answer even when I type Jupiter) Help

import java.util.Scanner;

public class Main {

public static void main(String args[]) {
    String question = "What is the largest planet in the solar system?";
    String choiceOne = "Earth";
    String choiceTwo = "Jupiter";
    String choiceThree = "Mars";

    String correctAnswer;
    correctAnswer = choiceTwo;

    // Write a print statement asking the question
    {System.out.println("What is the largest planet in the solar system?");}
    // Write a print statement giving the answer choices
    {System.out.println("Choose one of the following:" + " " + "Earth," + " " + "Jupiter," + " " + "Mars");}
    // Have the user input an answer
        Scanner scanner = new Scanner(System.in);
    // Retrieve the user's input
    String input = scanner.next();
    // If the user's input matches the correctAnswer...
    if(choiceTwo.equals(input.toLowerCase()))
    // then the user is correct and we want to print out a congrats message to the user.
    {System.out.println("Congrats! You are correct!");}
    // If the user's input does not match the correctAnswer...
    else {System.out.println("Incorrect, the correct answer is" + " " + correctAnswer);}
    // then the user is incorrect and we want to print out a message saying that the user is incorrect as well as what the correct choice was.

}

}

Missing the Code of Conduct

Hello,
Your project is currently missing the Code of Conduct. If you are willing to add one, then I can submit a PR including that. In that case, I would need a valid contact address (email address) which would get enlisted in your Code of Conduct. Let me know what do you think about that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.