Posted by **gaurav** on Sunday, October 16, 2011 at 8:03pm.

i have two numbers...

1564656

1981676

i want to check if the first and the last number from a string of these numbers are the same or not...how would i do that. how would i just compare the first and a last number and ignore the other numbers in this string?

my code so far...

class lotto

{

public static void main(String[] args)

{

JOptionPane.showMessageDialog (null, " LOTTOMAX - PLAY - WIN");

String numgen =JOptionPane.showInputDialog (null, " ENTER 7 DIGIT NUMBER:" );

int playa1 = Integer.parseInt(numgen);

JOptionPane.showMessageDialog (null, playa1);

int LottoRandom = (int)(Math.random()*10000000);

JOptionPane.showMessageDialog (null, LottoRandom);

if (playa1 >10000000 )

{

JOptionPane.showMessageDialog (null, " INVALID NUMBER. ");

}

## Answer This Question

## Related Questions

- math - the binary system is used for computer programming. a binary number ...
- Algebra - Four numbers have a total of 92. The first number is twice the second ...
- Grade 8 Math - Can you write them in Mathematical/numbers form I'll solve them ...
- math word problems - The sum of two numbers is 69. The second is 9 more than 4 ...
- algebra - true or false 1. fraction cant be written as decimal. 2. natural ...
- Math - Suppose you have two numbers. The difference of the two numbers is 12. ...
- math - my number is a multiple of 5, but doesnt end in 5, the prime ...
- Math - When factoring a trinomial that is in the format Ax^2 + Bx + C, the ...
- College Algebra - The sum of two numbers is less than 12. The second number is 8...
- math - Please help me to find the first and third quartiles, Q1 and Q3, of the ...

More Related Questions