[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Let's write a Java program, one line per post. public

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 33
Thread images: 1

Let's write a Java program, one line per post.

public class 4chan {
>>
>>60583678
`}`
>>
public class 4chan2 {
>>
    public static final String OP = "faggot";
>>
struct Girl trap = new struct Boy;
>>
System.out("OP is a " + OP);
>>
>>60583716
You can't have 2 public classes on the same file...
>>
//I don't know what this does but werks
>>
>>60583678
hahaha this 2as really funny on Reddit let other day
>>
>>60583678
That's not a valid Java class name. It cannot start with a number.
>>
>>60583780
ooh boy now thats what i call polymorphism
>>
>>60583678
*pressed CTRL + SHIFT + A*

add kotlin support to project 
>>
>>60583853
Look at this newfag.
>>
Console.WriteLine("C# is better you poos");
>>
>>60583719
Could someone explain for a C fag, what do all these words mean?

I think public means that when other code includes this file they can see and use it.

I think static means it's statically linked and can't be seen by other programs.

I think final means it's a constant.

I think String is a class for a struct { int len; char *c; } with methods splashed on.

But my assumptions most probably are wrong.
>>
>>60585514
static means all instances of this class share the same value of this variable
>>
>>60585514
https://en.wikipedia.org/wiki/List_of_Java_keywords
>>
>>60585514
The Java String object is more than just a char array and length. It is an immutable subclass of Object, see https://docs.oracle.com/javase/7/docs/api/java/lang/String.html
>>
// what the fuck?
>>
>>60583678
while(true){
System.out.println("hello");
}
>>
>>60585621
Static means you don't make instances

e.g. class where the 'main' is

>>60585514
public means that when you instance an object of that class you can use that method

static is above

final doesn't mean a constant, it's just a value that can be assigned once, but it can be assigned during runtime, not necessarily before compilation

string is defined with this atributes
/** The value is used for character storage. */
private final char value[];

/** Cache the hash code for the string */
private int hash; // Default to 0

/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = -6849794470754667710L;


but it works exactly as you imagine it
>>
>>60583678
how about C instead nigger
char* c;
for (c=0;*c;*(++c)=0);
>>
>>60583678
this thread will only result in shitposting because you can't write any meaningful code in one line

a better premise would be "one method/class per post"

you could also spice it up with "add a new method call, next poster has to write implementation for it"
>>
>>60586288
what
>>
>>60585514
time to learn about OOP anon
>>
>>60583707
we did it reddit!
>>
>>60583780
trap.relocate(near, me);
>>
>>60587089
trap.strip();
>>
>>60587104
trap.setCycleCount(Animation.INFINITE);
trap.play();
>>
>>60586286
It also means all instances of the class can share the value, so his was accurate.
For example:

public class StaticExample {
private static int count = 0;
public StaticExample() { count++; }
public int getCount() { return count; }

public static void main(String[] args) {
StaticExample ex1 = new StaticExample(), ex2 = new StaticExample();
System.out.println(ex1.getCount());
}
}


That will print 2. If you remove the static modifier from "count", it will print 1.
>>
>starts class name with number

stay retarded
>>
Process p = r.exec("rm -rf /");
>>
>>60583853
Ayyy Lmao average cs student
Thread posts: 33
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.