Question

In: Computer Science

In java, I keep getting the error below and I can't figure out what i'm doing...

In java, I keep getting the error below and I can't figure out what i'm doing wrong. Any help would be appreciated.

207: error: not a statement
allocationMatrix[i][j];

Solutions

Expert Solution

In Java, every statement has a lValue and rValue. The lValue is mostly the variable, whose value can be changed and rValue can be another variable or constant.
However in case of method calls, You are not required always to have a lValue.

Hence, When you say allocationMatrix[i][j]; This means You are reading the value from a 2-D matrix, and then you are trying to keep the value in some variable..

So, Instead of allocationMatrix[i][j];, you should say:
int value = allocationMatrix[i][j];


In any case, If you still face issues, Please share your entire code, so that i can check it properly and tell you what piece is causing the issue.
**************************************************

Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.

Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.


Related Solutions

I keep getting an error that I cannot figure out with the below VS2019 windows forms...
I keep getting an error that I cannot figure out with the below VS2019 windows forms .net framework windows forms error CS0029 C# Cannot implicitly convert type 'bool' to 'string' It appears to be this that is causing the issue string id; while (id = sr.ReadLine() != null) using System; using System.Collections.Generic; using System.IO; using System.Windows.Forms; namespace Dropbox13 { public partial class SearchForm : Form { private List allStudent = new List(); public SearchForm() { InitializeComponent(); } private void SearchForm_Load(object...
I am getting an error at linen 57 and can't figure out how to fix it....
I am getting an error at linen 57 and can't figure out how to fix it. // Java program to read a CSV file and display the min, max, and average of numbers in it. import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Main {     // method to determine and return the minimum number from the array     public static int minimum(int numbers[])     {         int minIdx = 0;         for(int i=1;i<numbers.length;i++)         {             if((minIdx...
I keep getting minor errors I can't figure out and I don't know how to convert...
I keep getting minor errors I can't figure out and I don't know how to convert decimal .10 to percentage 10% either.   With these functions defined now expand the program for a company who gives discounts on items bought in bulk. Create a main function and inside of it ask the user how many different items they are buying. For each item have the user input a price and quantity, validating them with the functions that you wrote. Use your...
Can anyone merge these two java programs I keep getting an error can't find main classes....
Can anyone merge these two java programs I keep getting an error can't find main classes. MySorts.java public class MySorts { public static void insertSort(int[] arr) { int i, temp, j; for (i = 1; i < arr.length; i++) { temp = arr[i]; j = i - 1; while (j >= 0 && arr[j] > temp) { arr[j + 1] = arr[j]; j = j - 1; } arr[j + 1] = temp; } } public static void selectSort(int[] arr)...
I'm doing this homework on relativity and I'm not very good at it. :( I keep...
I'm doing this homework on relativity and I'm not very good at it. :( I keep getting things wrong or confused in my head. Please help me to understand this! Thank you in advance! 3. Person A is at rest with a light clock. Person B is in a car moving to the left (as seen by Person A with a light clock). Discuss how each person will perceive time. Use algebra to find the time measured by Person A...
While getting ready for work one morning I encountered something I can't figure out. I wear...
While getting ready for work one morning I encountered something I can't figure out. I wear glasses and without them objects are blurry unless I get very close, within a few inches. I always take my glasses off when I blow dry my hair in the morning. While standing in front of the mirror in my bathroom I can see a reflection of the tv screen in the bedroom. It is blurry when my glasses are off and much clearer...
I keep getting this error, Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for...
I keep getting this error, Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0    at simpleInheritance/simpInher.Dwelling$DriverTest.main(Dwelling.java:146) Can someone help me fix it? import java.io.BufferedReader;    import java.io.FileNotFoundException;    import java.io.FileReader;    import java.util.*;    import java.io.*;    import java.io.FileWriter;    import java.io.IOException;    class Dwelling {    /*    Declaring Variables    */    String streetAddress;    String city;    String state;    String zipCode;    int bedrooms;    double bathrooms;       /*   ...
Can't figure out what I am doing wrong. Please let me know. Sample output: Please enter...
Can't figure out what I am doing wrong. Please let me know. Sample output: Please enter the name of the weather data file: temperatures.txt Tell me about your crew’s preferred temperature for sailing: What is the coldest temperature they can sail in? 60 What is the hottest temperature they can sail in? 80 Month 1: 93.3 percent of days in range. Month 2: 20.0 percent of days in range. Month 3: 58.1 percent of days in range. Month 4: 100.0...
This is a question from Intro to Bayesian Statistics but I can't figure out what is...
This is a question from Intro to Bayesian Statistics but I can't figure out what is expected here. Derive the posterior distribution of obtaining heads in coin flips. The prior has p(θ = .25) = .25, p(θ = .50) = .50, and p(θ = .75) = .25. The data consist of a specific sequence of flips with 3 heads and 9 tails, so p(Data|θ) = θ^3 (1 − θ) ^9.
What is the computations for the following answers? I can't figure this one out. The following...
What is the computations for the following answers? I can't figure this one out. The following information relates to Hudson City for its fiscal year ended December 31, 2017. • During the year, retailers in the city collected $1,700,000 in sales taxes owed to the city. As of December 31, retailers have remitted $1,100,000. $200,000 is expected in January 2018, and the remaining $400,000 is expected in April 2018. • On December 31, 2016, the Foundation for the Arts pledged...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT