Jump to content


Photo

Learning /Starting Java programming.


  • Please log in to reply
4 replies to this topic

#1 rkhanal

rkhanal

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 22 May 2008 - 01:39 AM

Hi all,

I am new to this
I am not from IT back ground as i work for finance. I read about Java techinology in my office all the time. I am interested to learn Java programming. I have gone through google and just starting to learn how to write " Hello world" in Java programming. I don't know where is my mistake in this little program.

I have named the java file as " Hello.java" as my public class file name is " Hello". Everytime when i try to compile it shows error on the first line of the program. Below is my Hello.java file. It would be very helpful if someone can help me.

==============

Public class Hello

{

// This is my first programming language


Public static void main ( string [] args )

{

// prints the world, Hello World on the screen

System.out.Println (" Hello world" );

}

}



many Thanks,

Ran

#2 dotbart

dotbart

    Young Padawan

  • Members
  • Pip
  • 141 posts
  • Gender:Male
  • Location:Diepenbeek
  • Interests:Webdesign, Webdeveloppement, DJ, ...

Posted 22 May 2008 - 06:20 AM

to help you, you need to help us. What are the error's you're getting?

one thing I noticed is you're using 'Public' instead of 'public' both in your main method and your class definition.


Something that might really help you is Eclipse. It's (in my opinion) the best Java IDE (Integrated Development Environment). with included compiler etc.
I'm sure you can find some info on how to work with it..

#3 rc69

rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 22 May 2008 - 12:54 PM

Java is case-sensitive.

Rules you should remember about how to decide which case to put something in:
1. Class names start with a capital letter
2. Keywords/variables/function names start with a lowercase letter.
3. Constants are in all-caps.

public class Hello{
	// This is my first programming language
	public static void main(string [] args){
		// prints the world, Hello World on the screen
		System.out.println("Hello world");
	}
}

Edited by rc69, 22 May 2008 - 12:55 PM.


#4 rkhanal

rkhanal

    Young Padawan

  • Members
  • Pip
  • 3 posts

Posted 22 May 2008 - 07:53 PM

I am still getting the Error :- Can't find symbol- class string. After compiling the code you have provided.

#5 CoryMathews

CoryMathews

    P2L Jedi

  • Members
  • PipPipPip
  • 554 posts
  • Gender:Male
  • Location:Texas

Posted 24 May 2008 - 07:49 AM

you just have wrong capitals all over. this code works

public class hello {
	// This is my first programming language
	public static void main(String[] args) {
		// prints the world, Hello World on the screen
		System.out.println(" Hello world");
	}
}

file name would be hello.java




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users