#10
|
||||
|
||||
Re: Java conversation
Code:
/* * This actually runs. */ public static void main(String[] args) { //You seriously just told me that I don't know Java. //And why are you just copy-pasting? System.out.println("-------------------\nX "); System.out.printf("%13.7f", d(5,7)); System.out.print(" X\n-------------------\n"); } public float d(int div, int di) { return (float)(div) / (float)(di); } //Tell me exactly what this prints. |
#17
|
||||
|
||||
Re: Java conversation
Code:
package com.uniteduniverse.libs; /** * isPrime library * @version 1.0 * @author SpaceMan */ public class isPrime { /** * Check if the integer is a prime number * @return boolean Is the integer prime? * @param integer The integer to be tested */ public static boolean isPrime(int integer) { for (int i = 2; i < integer; i ++) { if (integer % i == 0) { return false; } } return true; } } |
#19
|
||||
|
||||
Re: Java conversation
static String sPhrase = "I Just started learning java like 2 weeks ago, so this all makes some since";
System.out.println(sPhrase); System.out.println(sPhrase.substring(8,28)+" are several random words/letters.'); //and thats about all I can do so far, I just learned how to ask for input. //I made a mistake didnt I? |
#20
|
||||
|
||||
Re: Java conversation
Code:
public static void main(String [] args){ object giratina; object shaymin; if (snack(giratina, shaymin)){ System.out.println("It's going to eat me!"); } else{ System.out.println("Well, I don't like Giratina. That monster tried to eat me!"); } } public int snack(object mouth, object food){ if (eat(mouth, food) = true) { return 0; } else { return 1; } } public boolean eat(object mouth, food){ //add eating code here } |
|