cannot use "v>=0"?
hello. i am trying to scan and obtain numbers in a list until an even and negative number is read. the number has to be even and negative. i am trying to use this while loop: while rem(v,2)~=0||v>=0. if i remove the "=" sign, it does the job for the most part, however "0" is not a negative number. that is why i am trying to use >=0. i keep getting the error "operands to the logical and (&&) and or (||) operators must be convertible to logical scalar values." is there another solution to determine if a number is not negative?
while rem(v,2)~=0 | v>=0
&& is a short circuit operator in java, which means that once it evaluates the left expression as false - it no longer evaluates the right expression.   

in our case, in the equals method evaluates 

```

obj instanceof person 
```
 to **true**; 

```

this.age == ((person)obj).age 
```
 to **false**; the next expression, 
```

this.name.equals(((person)obj).name);
```
 is not evaluated at all, and the method returns **false**.   

changing the && operator to || or & would result in a java.lang.nullpointerexception Check if any of the values in the cells are null.  

If they are you need to modify your code to check for null conditions before using `ToString()`. for this, just use an if function. see https://macmost.com/learn-how-to-use-the-if-function-in-numbers.html so something like this in a2: if(isblank(b2),c2,b2) the condition is to check if b2 is blank. if it is, get the value of c2. if it isn’t blank, then get the value of b2. you can use lazy evaluation so if the first expression returns true it will not check the second expression. just change the ‘or’ in your statement to ‘orelse’ so it would be:

“string.isnullorempty(message) orelse message.contains(”!")" You need to give the user the option of typing in a value that represents that there are no more values to enter. Perhaps give a prompt like:



```
Please enter a value.  Enter -999999 if you have no more values [B]:[/B]
```

As for the ten (or fewer) values, you should probably have an array and a loop instead of ten separate variable names and ten separate cin statements. So you're looking at something like this:



```
double dValue[10];
    int numEntries = 0;
    double sum = 0;
    
    while (numEntries < 10)
    {
          cout << "Enter number (-999999 to stop) : ";
          cin >> dValue[numEntries];
          // check whether dValue[numEntries] == -999999
          // if so, short-circuit the loop with the "break" command
            
          // increment numEntries
          // adjust sum
    }
```

As a side note, I picked -999999 as the value to represent no more values because



1. It's an integer, so it can be represented exactly as a double (no round-off error using == to compare).
2. It's a number that, chances are, people wouldn't actually want to add, so it's sort of "out of the way". Chances are, few people want to add -999999. If they do, they can't use this program! Hi Valdeth. You should use input and output file streams if you want to write and read from a file. Basically you open the file for writing and once you are done close the file. Later you can open the file for reading. The example below reads numbers from the file and just prints them out. If you want to read the file line by line you should look at the getline() function. I have just used your initial array to come up with a result per array which gives the product of all negative numbers in the array. Note that there **HAS** to be at least 1 negative number per array.



```
const int m=4, n=5;
	int i,j;
	int num;
	int result;
	int A[m][n]={{5,3,-4,8,2},
				 {1,5,2,7,-8},
				 {-3,9,5,2,4},
				 {4,-1,3,6,8}};

	ofstream outfile;
	ifstream infile; 

	outfile.open("c:/matrix/matrix.txt");

	for (i=0;i<m;i++)
	{
		result = 1;

		for (j=0;j<n;j++)
		{
			outfile << setw(3)<< A[i][j];

                            // Multiply negative numbers in each array (has to be at least 1 negative number in each array)
			if (A[i][j] < 0)              				                      result *= A[i][j];  // result = result x A[i][j]
		}
		cout << "Result of array " << i << " is " << result << endl;
		outfile << "\n";
	}

	outfile.close(); // Close for writing

	infile.open("c:/matrix/matrix.txt"); // opens the file
    
	infile >> num;
	while ( !infile.eof() ) 
	{ // keep reading until end-of-file
		cout << "The next number is " << num << endl;
		infile >> num; // sets EOF flag if no value found
	}
	infile.close();  //Close for reading
``` Here, this should do it. I just replaced the

 
```
System.out.println(isPrime(n));

```
 part, which would print true or false, with an if

 
```
if (isPrime(n))
    System.out.println("The number is prime.\n");
else 
    System.out.println("The number is not prime.\n");

```
 Here's the code:

 
```
import java.util.Scanner;
public class PrimeNumber{
    public static void main(String args[]){
        int n;
        Scanner Prime = new Scanner(System.in);
        System.out.println(" Please enter a number: ");
        n = Prime.nextInt();
        if (isPrime(n))
            System.out.println("The number is prime.\n");
        else 
            System.out.println("The number is not prime.\n");
    }

    static boolean isPrime(int n) {
        if (n%2==0)return false;
        for(int i=3;i*i<=n;i+=2) {
            if(n%i==0)
                return false;
        }
        return true;
    }
} 

```
 This is a trivial task. You should probably read your coursebook/tutorials, I bet you'll find the answers there. hi [@rrenu59](/u/rrenu59)

form my knowledge

isnothing - method used to check if the variable is initalized, nothing means the variable is not intialized (i.e) there is no memory is allocated for this variable

nullorwhitespace - it is to check whether it is empty or contain any whitespace. Your function works, but both the IF and the ELSE return an alert message that says its invalid.  

The first part - the IF - should return in the alert box "Valid SSN"  

I am assuming your input should be like this 123-45-1234


but do you need to tell the user the input is valid? Surely the alert should only be displayed if the input is invalid? So the if should return nothing. imho not sure i understood. are you having problems with this code?

if yes, i think you’re using the wrong comparison operator (not = but ==).