Показать сообщение отдельно
Непрочитано 13.06.2011, 23:32   #8
Аватар для Effas
Пользователь

Автор темы (Топик Стартер) Re: Ошибка после исполнения программы

Эмм...
PHP код:
import javax.swing.*;

public class 
Calculator {
    public static 
void main(String[] args) {
        
String a JOptionPane.showInputDialog("Введите 1-е число:");
        
String itog JOptionPane.showInputDialog("Введите знак:");
        
String b JOptionPane.showInputDialog("Введите 2-е число:");

        
// Парсим переменные.
        
int a1 Integer.parseInt(a);

        
int b1 Integer.parseInt(b);

        
// Установка условия.
        
switch(itog) {
            case 
'+':
                
itog a1 b1;
                break;
            case 
'-':
                
itog a1 b1;
                break;
            case 
'*':
                
itog a1 b1;
                break;
            case 
'/':
                
itog a1 b1;
                break;
            default:
                
JOptionPane.showInputDialog("Вы ввели не правильный знак!");
        }

        
String message "Результат: " itog1;
        
JOptionPane.showInputDialog(message);
        
System.exit(0);
    }

PHP код:
E:\Java\Calculator\Calculator.java:15incompatible types
found   
java.lang.String
required
int
        
switch(itog) {
               ^
E:\Java\Calculator\Calculator.java:17incompatible types
found   
int
required
java.lang.String
                itog 
a1 b1;
                          ^
E:\Java\Calculator\Calculator.java:20incompatible types
found   
int
required
java.lang.String
                itog 
a1 b1;
                          ^
E:\Java\Calculator\Calculator.java:23incompatible types
found   
int
required
java.lang.String
                itog 
a1 b1;
                          ^
E:\Java\Calculator\Calculator.java:26incompatible types
found   
int
required
java.lang.String
                itog 
a1 b1;
                          ^
E:\Java\Calculator\Calculator.java:32cannot find symbol
symbol  
variable itog1
location
: class Calculator
        String message 
"Результат: " itog1;
                                         ^
6 errors

Tool completed with 
exit code 1 
Добавлено через 3 минуты
Сек, доковыряю.

Последний раз редактировалось Effas; 13.06.2011 в 23:36. Причина: Добавлено сообщение
Effas вне форума Отправить сообщение для Effas с помощью Skype™ Ответить с цитированием