[Question] Coding Syntax

12/13/2010 08:35 Syst3m_W1z4rd#16
Quote:
Originally Posted by InfamousNoone View Post
Code:
    class Program
    {
        public static int Cookies { get; private set; }
        static void Main(string[] args)
        {
            Cookies = int.Parse(Console.ReadLine());
            Console.WriteLine(Cookies > 0 ? "You have cookies!" : "You have no coookies!");
        }
    }
The point was to make it looks crazy xD
But u just learned me a thing, I never knew was possible. Cookies > 0 ?
:awesome:
12/13/2010 08:47 ChingChong23#17
Quote:
Originally Posted by Syst3m_W1z4rd View Post
The point was to make it looks crazy xD
But u just learned me a thing, I never knew was possible. Cookies > 0 ?
:awesome:
Ternary operation - Wikipedia, the free encyclopedia
12/13/2010 19:46 ImmuneOne#18
Quote:
Originally Posted by InfamousNoone View Post
Saint (tao4229) and I despise Java, that's why I thought it'd be funny to post that. I'm glad other than us picked up on the joke.
12/13/2010 23:25 xScott#19
Quote:
Originally Posted by InfamousNoone
Console.WriteLine(Cookies > 0 ? "You have cookies!" : "You have no coookies!");
what does that do o-o
explain? :)

edit: nvm google is my friend.

Quote:
Originally Posted by ImmuneOne View Post
[Only registered and activated users can see links. Click Here To Register...]
lol'd
12/13/2010 23:30 Syst3m_W1z4rd#20
Quote:
Originally Posted by xScott View Post
what does that do o-o
explain? :)



lol'd
Read the link by ChingChong.
12/14/2010 06:28 ChingChong23#21
that Java the Javatar is gold, saw it awhile ago.
12/14/2010 06:42 Ian*#22
I saw someone posted that on cxp a few months back.

If I told you what I think of java i'd just be trollin'.
12/14/2010 07:28 InfamousNoone#23
I just linked nearly every programmer on my MSN list to that Java video.
Bricks were shat.
12/14/2010 14:02 tanelipe#24
Yah, java is fun. Here's a code to print "Hello world!":
PHP Code:
interface Printer {
    
void print(Message message);
}

class 
Message {
    private 
String message;

    public 
Message(String message) {
        
this.message message;
    }

    public 
void print(Printer printer) {
        
printer.print(this);
    }

    public 
String toString() {
        return 
message;
    }
}

abstract class 
AbstractPrinterFactory {
    public static 
AbstractPrinterFactory getFactory() {
        return new 
SystemOutPrinterFactory();
    }

    public abstract 
Printer getPrinter();
}

class 
SystemOutPrinterFactory extends AbstractPrinterFactory {
    public 
Printer getPrinter() {
        return new 
SystemOutPrinter();
    }
}

class 
SystemOutPrinter implements Printer {
    public 
void print(Message message) {
        
System.out.println(message);
    }
}

class 
HelloWorld {
    public static 
void main(String[] args) {
        
Message message = new Message("Hello world!");
        
AbstractPrinterFactory factory SystemOutPrinterFactory.getFactory();
        
Printer printer factory.getPrinter();
        
message.print(printer);
    }

P.S Loved the video.
12/14/2010 21:30 .Kinshi#25
Quote:
Originally Posted by tanelipe View Post
Yah, java is fun. Here's a code to print "Hello world!":
PHP Code:
interface Printer {
    
void print(Message message);
}

class 
Message {
    private 
String message;

    public 
Message(String message) {
        
this.message message;
    }

    public 
void print(Printer printer) {
        
printer.print(this);
    }

    public 
String toString() {
        return 
message;
    }
}

abstract class 
AbstractPrinterFactory {
    public static 
AbstractPrinterFactory getFactory() {
        return new 
SystemOutPrinterFactory();
    }

    public abstract 
Printer getPrinter();
}

class 
SystemOutPrinterFactory extends AbstractPrinterFactory {
    public 
Printer getPrinter() {
        return new 
SystemOutPrinter();
    }
}

class 
SystemOutPrinter implements Printer {
    public 
void print(Message message) {
        
System.out.println(message);
    }
}

class 
HelloWorld {
    public static 
void main(String[] args) {
        
Message message = new Message("Hello world!");
        
AbstractPrinterFactory factory SystemOutPrinterFactory.getFactory();
        
Printer printer factory.getPrinter();
        
message.print(printer);
    }

P.S Loved the video.

Now don't get me wrong, I think Java is horrible.
But you're over exaggerating :P

Code:
package helloworld;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
Now if you wanted to show something horrible in Java, show how you open and work with files! Ugh!
12/15/2010 05:32 ChingChong23#26
make your own framework wrapped around java's file IO system, if you want it spoonfed to you like .net does.
12/15/2010 08:07 InfamousNoone#27
Thing is though, .NET allows you to chose whether to be spoon fed, or whether to PInvoke and do it all yourself. Java on the other hand bitch slaps you with JNI which is just such a pain.
12/15/2010 08:12 mazestricks#28
if(condition)
{
statement
}
12/15/2010 13:39 ChingChong23#29
Quote:
Originally Posted by InfamousNoone View Post
Thing is though, .NET allows you to chose whether to be spoon fed, or whether to PInvoke and do it all yourself. Java on the other hand bitch slaps you with JNI which is just such a pain.
if you work with dll's a lot (which i assume you do) then i can understand why you dislike java
12/15/2010 23:23 InfamousNoone#30
The idea of J# (or just the general idea of coding an extension on top of the .NET framework that would allow Java code to compile to IL) and extend the language further to support some of .NET's features was brilliant. It's too bad it was discontinued.
[Only registered and activated users can see links. Click Here To Register...]

[Only registered and activated users can see links. Click Here To Register...]
Is also brilliant too, but looks like it's not being updated any further either.