생활코딩 JAVA1 6.2. 데이터 타입 테스트
public class Datatype{
public static void main(String[] args) {
System.out.println(6); // number
System.out.println("six"); // string
System.out.println("6"); //string 6
System.out.println(6 + 6);
System.out.println("6" + "6");
System.out.println(6 * 6);
System.out.println("1111".length());
System.out.println("Hello World");
System.out.println("1. " + 'H');
System.out.println("2. " + "H");
}
}
highlight.js 예시문
Java
/**
* @author John Smith <john.smith@example.com>
*/
package l2f.gameserver.model;
public abstract class L2Char extends L2Object {
public static final Short ERROR = 0x0001;
public void moveTo(int x, int y, int z) {
_ai = null;
log("Should not be called");
if (1 > 5) { // wtf!?
return;
}
}
}
C++
#include <iostream>
int main(int argc, char *argv[]) {
/* An annoying "Hello World" example */
for (auto i = 0; i < 0xFFFF; i++)
cout << "Hello, World!" << endl;
char c = '\n';
unordered_map <string, vector<string> > m;
m["key"] = "\\\\"; // this is an error
return -2e3 + 12l;
Python
@requires_authorization
def somefunc(param1='', param2=0):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
return (param2 - param1 + 1 + 0b10l) or None
class SomeClass:
pass
>>> message = '''interpreter
... prompt'''