Click here to Skip to main content
15,887,596 members
Home / Discussions / Java
   

Java

 
QuestionMy First Java Pin
MallardsReach12-Mar-20 10:07
MallardsReach12-Mar-20 10:07 
AnswerRe: My First Java Pin
Richard MacCutchan12-Mar-20 23:23
mveRichard MacCutchan12-Mar-20 23:23 
GeneralRe: My First Java Pin
MallardsReach13-Mar-20 2:59
MallardsReach13-Mar-20 2:59 
Questionbooks examples of precedures stored for sqlserver Pin
Member 147683149-Mar-20 21:20
Member 147683149-Mar-20 21:20 
AnswerRe: books examples of precedures stored for sqlserver Pin
Richard MacCutchan9-Mar-20 22:25
mveRichard MacCutchan9-Mar-20 22:25 
AnswerRe: books examples of precedures stored for sqlserver Pin
ZurdoDev12-Mar-20 11:03
professionalZurdoDev12-Mar-20 11:03 
QuestionPLEASE HELP JAVA Pin
Member 147599401-Mar-20 14:19
Member 147599401-Mar-20 14:19 
AnswerRe: PLEASE HELP JAVA Pin
Richard MacCutchan1-Mar-20 21:36
mveRichard MacCutchan1-Mar-20 21:36 
The call to System.out.println is outside of the main method, which is incorrect. Using proper indentation helps to see such basic errors.
It should be
Java
import java.util.Random;

public class TwoDiceGame {
    public static void main(String[] args){
        // Declare a counter variable to count the loop time
        int count = 0;
        int die1, die2;
        
        for(int i=0;i<100;i++) { // on reflection the problem is this missing open brace        
            rNums = new Random(); // create a new object of Random class
            int die1 = rNums.nextInt(6)+1;  // you already declared die1 and die2 above
            int die2= rNums.nextInt(6)+1;
            if(Die1 + Die2 >= 10);  // you have mis-spelled the names of the two die variables
            count ++;
        } // this brace closes the for loop
    
        System.out.println ("Out of 100 rolls of the two dice, the total of both the dice greater than or equal to 10 was %d times");
    } // this is the correct closing of main
// { this open brace should not be here
} // this closes the class 

AnswerRe: PLEASE HELP JAVA Pin
Richard MacCutchan1-Mar-20 21:42
mveRichard MacCutchan1-Mar-20 21:42 
GeneralRe: PLEASE HELP JAVA Pin
Member 1477360615-Mar-20 10:11
Member 1477360615-Mar-20 10:11 
GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan15-Mar-20 12:26
mveRichard MacCutchan15-Mar-20 12:26 
AnswerRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 3:12
MallardsReach13-Mar-20 3:12 
GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan13-Mar-20 4:30
mveRichard MacCutchan13-Mar-20 4:30 
GeneralRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 6:33
MallardsReach13-Mar-20 6:33 
GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan13-Mar-20 6:49
mveRichard MacCutchan13-Mar-20 6:49 
GeneralRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 7:15
MallardsReach13-Mar-20 7:15 
QuestionTransfer data from SQL database to populate spinner Pin
Member 1475169121-Feb-20 5:55
Member 1475169121-Feb-20 5:55 
AnswerRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 6:10
mveRichard MacCutchan21-Feb-20 6:10 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169121-Feb-20 7:38
Member 1475169121-Feb-20 7:38 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 22:08
mveRichard MacCutchan21-Feb-20 22:08 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169122-Feb-20 14:38
Member 1475169122-Feb-20 14:38 
QuestionJson Manager Project (Need Critique/Possible Tips) Pin
Member 147385357-Feb-20 16:20
Member 147385357-Feb-20 16:20 
AnswerRe: Json Manager Project (Need Critique/Possible Tips) Pin
Richard MacCutchan7-Feb-20 22:06
mveRichard MacCutchan7-Feb-20 22:06 
GeneralRe: Json Manager Project (Need Critique/Possible Tips) Pin
Member 147385358-Feb-20 3:56
Member 147385358-Feb-20 3:56 
QuestionHow to optimize the time complexity of counting a word Pin
neelayak7-Feb-20 3:28
neelayak7-Feb-20 3:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.