Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Aditi Msc   on Mar 28 In Java Category.

  
Question Answered By: Rosalie Holmes   on Mar 28

import  java.io.*;
class  hello{
> public static  void main(string args[])
> system.out.print("hello java");
> }
shows  that ; is expected dont know why.

You're missing the left bracket for main

> 2 mport public  package java.lang
> import public package  java.lang.math
> class SquareRoot
> {
> public static void  main(string args[])
> {
double  x=5;
> double y;
> y=math.sqrt(x);
> system.out.println("y="+y);
> }
> its shows indentifier expected and . expected

"math" is not a class. "Math" is. case sensitivity is
very important.

> 3.
> Import java.lang.
> Public class Employee extends java.lang
> {
string  employeeName;
> string employeeAddress;
> public Employee()
> {
> employeeName="Carol";
> employeeAddress="21 Rock st.";
> }
> public void DisplayDetails()
> {
> system.out.println("Name of an Employee
> is"+employeeName);
> system.out.println("Address of an employee
> is"+employeeAddress);
> }
> public static void main(string args[])
> {
> Employee employeeObject=new Employee();
> employeeObject.displayDetails();
> }
> }

"string" is not a class. "String" is.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on java. aim using jdk1.4 on win2k Or get search suggestion and latest updates.


Tagged: