fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. function DemoObject;
  13. {
  14. this.fName = "Fred";
  15. this.lName = "Feuerstein";
  16.  
  17. this.greet = function(frage);
  18. {
  19. var name = this.fName + " " +this.lName;
  20. return "Hallo" + name + "!" + frage;
  21. }
  22. }
  23.  
  24. var wilma = new DemoObject();
  25. wilma.fName = "Wilma";
  26. alert(wilma.greet("Wie geht es Dir"));
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: cannot find symbol
		function DemoObject;
		^
  symbol:   class function
  location: class Ideone
Main.java:14: error: non-static variable this cannot be referenced from a static context
			this.fName = "Fred";
			^
Main.java:14: error: cannot find symbol
			this.fName = "Fred";
			    ^
  symbol: variable fName
Main.java:15: error: non-static variable this cannot be referenced from a static context
			this.lName = "Feuerstein";
			^
Main.java:15: error: cannot find symbol
			this.lName = "Feuerstein";
			    ^
  symbol: variable lName
Main.java:17: error: non-static variable this cannot be referenced from a static context
			this.greet = function(frage);
			^
Main.java:17: error: cannot find symbol
			this.greet = function(frage);
			    ^
  symbol: variable greet
Main.java:17: error: cannot find symbol
			this.greet = function(frage);
			                      ^
  symbol:   variable frage
  location: class Ideone
Main.java:19: error: cannot find symbol
				var name = this.fName + " " +this.lName;
				^
  symbol:   class var
  location: class Ideone
Main.java:19: error: non-static variable this cannot be referenced from a static context
				var name = this.fName + " " +this.lName;
				           ^
Main.java:19: error: cannot find symbol
				var name = this.fName + " " +this.lName;
				               ^
  symbol: variable fName
Main.java:19: error: non-static variable this cannot be referenced from a static context
				var name = this.fName + " " +this.lName;
				                             ^
Main.java:19: error: cannot find symbol
				var name = this.fName + " " +this.lName;
				                                 ^
  symbol: variable lName
Main.java:20: error: incompatible types: unexpected return value
				return "Hallo" + name + "!" + frage;
				                            ^
Main.java:20: error: cannot find symbol
				return "Hallo" + name + "!" + frage;
				                              ^
  symbol:   variable frage
  location: class Ideone
Main.java:24: error: cannot find symbol
		var wilma = new DemoObject();
		^
  symbol:   class var
  location: class Ideone
Main.java:24: error: cannot find symbol
		var wilma = new DemoObject();
		                ^
  symbol:   class DemoObject
  location: class Ideone
17 errors
stdout
Standard output is empty