A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • one year ago

A for statement isn't running inside of my document

  • This Question is Open
  1. AdozenBABYdogs
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    package polyDiv; import java.util.*; public class polyDivide { @SuppressWarnings("resource") public static void main(String[] args) { //Initialization and decoration// Scanner in = new Scanner(System.in); float r, b, d, p; int i, j; float[] a, c, n, m; //Introduction// System.out.println("Welcome to the Polynomial Divider!"); System.out.println("Divide things like X^2 and so on!"); System.out.println(""); //loopidy loop// while (true) { System.out.print("Please input the number of the highest exponent: "); i = in.nextInt(); n = new float[i]; m = new float[i]; a = new float[i]; c = new float[i]; for (j = 0; j > i; j++) { System.out.print("Please input a when a is aX^" + (i-j) + ": "); a[i-j] = in.nextFloat(); } for (j = 0; j > i; j++) { System.out.print("Please input c when c is cX^" + (i-j) + ": "); c[i-j] = in.nextFloat(); } } } }

  2. mathmate
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    the second parameter of your for-loops is playing a trick on you. Read up: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html and note the definition: "When the termination expression evaluates to false, the loop terminates." since j=0 to start, j>i is already false, so the loop never got executed.

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.