Questions tagged [drjava]

A lightweight IDE for java, designed primarily for students

DrJava is a lightweight development environment for writing Java programs.

It is designed primarily for students, providing an intuitive interface and the ability to interactively evaluate Java code. It also includes powerful features for more advanced users. DrJava is available for free under the BSD License, and it is under active development by the JavaPLT group at Rice University.

For more information and downloads, visit the official site.

188 questions
-1
votes
1 answer

How do you use a return method to convert integers into binary numbers?

I'm in my first year comp sci class and I'm using Drjava. I have an assignment to have the user input two numbers, both ranging from 0 to 255, convert them to binary numbers, add these numbers, then output their binary version of the sum. My program…
Matthew Wu
  • 11
  • 1
-1
votes
1 answer

Dr Java program gets errors when writing query to MySQL Workbench

I made a program that makes a simple GUI for a login form. Just for testing purposes I made it so when you click the "Login" button, Java should just print out the query results from MySQL database. In MySQL I have a database schema called "test"…
Angelo Rivera
  • 191
  • 1
  • 2
  • 7
-1
votes
3 answers

Compile error: Incompatible operand types java.lang.String and char

import java.io.*; import hsa.Console; import java.awt.*; public static void main(String[] args) throws IOException { c = new Console(); String sentence; String encrypt = ""; String vowels = "AEIOUaeiou"; …
user2353211
  • 13
  • 1
  • 2
-1
votes
3 answers

Please help me finish my DrJava code. I'm confused on how to finish it

Design and implement an application that reads a string from the user, then determines and prints the number of vowels and consonants which appear in the string. Use a switch statement inside a loop. A typical program output might be: Enter a…
user1610594
  • 13
  • 1
  • 3
-1
votes
2 answers

What does an illegal class literal mean when trying to run a program?

I have created a project in Dr. Java which after compiling can automatically be converted into a Jar file to then converted into an .exe however I keep getting this error: Illegal class literal when i try to test run the project any idea why this…
user1469139
  • 13
  • 1
  • 9
-2
votes
1 answer

How can I create a new class and create a new variable of its type?

import javax.swing.JFrame; public class XFrame extends JFrame { } I saved with name XFrame and compiled it, no bug. But when I want to create a new variable of type XFrame in the interaction pane: new XFrame() It showed "Static Error : Undefined…
JarvisLYu1
  • 9
  • 1
  • 1
-2
votes
1 answer

How do I approximate the value of sum after the following code fragment, in terms of variable n in Big-Oh notation?

This is the code that was provided, I don't understand what to do at all or how to get to the answer. int sum = 0; for (int i = 1; i <= n - 3; i++) { for (int j = 1; j <= n + 4; j += 5) { for (int k = 1; k <= n + 4; k += 5) { …
-2
votes
3 answers

Java: method not returning to main

In Java for some reason the averageSpeed method is not returning a double value or any value. It seems that the method never exits back to the main method for some reason. I do not understand why this happens. The values I input are accordingly 0,…
-2
votes
1 answer

How to fix the error "Syntax error, insert "}" to complete Statement"?

1 error found: File: C:\Users\little\OneDrive\lab_2.java [line: 70] Error: Syntax error, insert "}" to complete Statement I am new to drjava. What wrong with my program? import java.util.Scanner; class lab_2 { public static void main…
Jabari Little
  • 1
  • 1
  • 1
  • 1
-2
votes
1 answer

How to write 2 strings on same line in Java

I have written a code in Java to compute the area and circumference of a circle. When I want to print the output, I can not do the following: "The area of a circle with a radius of" +radius "is" +area Instead, it prints like: "The area of a circle…
-2
votes
2 answers

Dr Java- Static Error: This class does not have a static void main method accepting String[]

I try running this program and I get a static void error. I am new to this and I have no idea how to fix this problem so any input would be helpful, thank you! package johnbarthelmes.Java; import java.awt.Color; import java.awt.Dimension; import…
-2
votes
2 answers

Hello I have a compiling issue, no matter what I seem to do I can't get rid of this error

I am currently working in drjava. Everything in the code below compiles but line 18, which generates the following error: Error: Syntax error, insert ";" to complete LocalVariableDeclarationStatement Can someone help me fix this? This is the…
-2
votes
3 answers

Bubble sort code in JAVA

I still can't get this right. The code in the bubble sort is incorrect. How can I get this right? What should I change or add to get the correct results? Thanks in advance. :) import java.util.Random; import java.util.Scanner; public class HomeWork…
-2
votes
2 answers

Having Trouble With Learning JOptionPane?

Instead of System.out.println for everything, I want to use JOptionPane. I don't know how to describe how my program is skipping code. If you could please take a look at this and help it go in order that would be highly appreciated. //Step 1:…
-3
votes
1 answer

Is it possible to reference another script inside the main one

At school we use a program doctorjava for coding. Now is it possible to import a class with custom methods that is located in a whole other script and if it is how can you reference it? edit: I know how to import java classes and packages and was…
Pa3ckP7
  • 39
  • 5
1 2 3
12
13