A list of puns related to "Java Me"
public class Weight {
private int pounds;
private double ounces;
private final int ouncesInPound = 16;
public Weight(int pounds, double ounces) {
this.pounds = pounds;
this.ounces = ounces;
}
public void display() {
System.out.println(pounds + " and " + ounces);
}
public int getPounds() {
return pounds;
}
public double getOunces() {
return ounces;
}
public boolean lessThan() {
if( weight1.lessThan(weight2)) {
return true;
}
}
public int addTo(int pounds) {
}
public String toString() {
return System.out.println(pounds + "lbs" + ounces + " oz");
}
private double toOunces(double ounces) {
return ounces;
}
public static void main(String[] args) {
Weight weight1 = new Weight(125, 3.5);
weight1.display();
Weight weight2 = new Weight(210, 4.8);
weight2.display();
Weight weight3 = new Weight(185, 8.9);
}
}
Currently focusing on this, I have never used .lessThan or do I know how to even approach it to have it find out if a weight is less than the others (pounds). Classes and instances I am still fresh on learning so I am a tad confused.
A public instance method named lessThan that accepts one weight as a parameter and returns whether the weight object on which it is invoked is less than the weight supplied as a parameter.
This question was posed only to understand if this is still being used in industry and perhaps to hear fun stories about those who used it back in the Java 2 days.
I need someone who can help me with my Java homework. and I need to submit it in a couple of hours. I will pay you fair. Dm me if you want to help me
I feel like I have implemented some complex projects in python (multi-modules). However whenever I am trying to read a java application I get totally lost. I understand the general project structure and feel like I can generally understand what individual classes and methods are doing...
However when it comes to piecing them together into how they are all logically interacting it becomes VERY difficult (or impossible) for me.
Maybe my java experience is just too limited and I definitely still don't understand a lot of the patterns or even syntax in the language (for example, generics, try-catch, are all kind of hard for me to implement).
Any advice on how to get better at just understanding what an application is doing? Am I just experiencing noob pains?
Hi! I need some help for a practice java FRQ that I find challenging, a tutor with a specific time slot arranged would be perfect. Thanks!
I always forget
Every time I try to sign in to the Minecraft launcher the message " Something went wrong in the login process" pops up. I've been trying to get it fixed but I can't so I've come here to see if anyone can help.
I'm trying to create multiple menus, and want to have a section go straight back to the beginning of the if statement, but I'm not sure how to code it. This is the very first project I've tried, and I am very much a beginner. This is what I have, including comments on what I want the code to do:
public class Application {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//main menu with three options
System.out.println("This is the main menu.\n1: Reduce a Fraction.\n2: Perform a Calculation.\n3: Exit Fraculator.");
int menuOneOption = input.nextInt();
//using if statements was my first thought because I can do multiple and be specific, without having to break the loop by adding anything. My second thought is that I could have each if statement turn into a while loop, but then I would have to find a way to stop the loop, without using an integer, in case the user inputs that specific integer as a mistake?
if (menuOneOption == 1) {
//I don't know how to split or use arrays yet, so getting the fraction one integer at a time is the best I can think of
System.out.println("To properly input your fraction use this format: X Y/Z.");
System.out.println("Type X here:");
int reduceX = input.nextInt();
System.out.println("Type Y here:");
int reduceY = input.nextInt();
System.out.println("Type Z here:");
int reduceZ = input.nextInt();
//verify the user has inputed the correct fraction
System.out.println("The fraction you would like to reduce is " + reduceX + " " + reduceY + "/" + reduceZ + " correct?");
System.out.println("1: Yes\n2: No\n3: Main Menu\n4: Exit Fraculator");
int reduceMenuOption = input.nextInt();
if (reduceMenuOption == 1) {
int reducedNumerator = reduceX / reduceZ;
System.out.println("Here is your reduced fraction: " + reducedNumerator + "/" + reduceZ + ".");
}
if (reduceMenuOption == 2) {
System.out.println("Please try again.");
//return to the beginning?
}
if (reduceMenuOption == 3) {
System.out.println("Thank you for using the Fraculator.\nHave a nice day.");
//stop program?
}
}
Should I just switch to loops? AHHHHhhhhhHH
A little backstory here, I'm a CS student but just as my second semester started, the pandemic hit, I flunked through three semesters, started freelance writing during this time to support myself and never actually learned anything about programming.
Now I'm back in uni and a lot of the current stuff I'm studying is going over my head. I want to develop some good programming foundations but I also want this to be something that can help me become a better web developer in the future.
The MOOC java course by University of Helsinki is something that's praised as perhaps the most reliable source to get your programming skills in shape and I want to start that on my own so I can cover up my PF, OOP and DSA gap from one place where I can actually implement the stuff I learn.
My goals are to first help myself pass University because there are some courses that require tons of programming and completing my degree with a crippled knowledge of programming isn't just happening.
The second thing is to learn something that will actually make it easier for me to earn something later in future most probably through web development.
And is there a resource to learn c++ that is also amazing in a similar way to this MOOC? Because my university mostly focuses on c++ and if I start with something like that, it would be easier for me to implement that in my courses as well. Or is learning java the same as learning c++ as I've heard the concepts used are mostly the same.
And what are your guys' opinions on me learning JavaScript first instead?
I know I shouldn't have wasted my time during the pandemic but I want to take the best possible approach from now on. Thanks!
I downloaded the jdk but still getting the same error when running the server
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.