Skip to content

Instantly share code, notes, and snippets.

View tharinduwijewardane's full-sized avatar
🇱🇰

Tharindu Wijewardane tharinduwijewardane

🇱🇰
View GitHub Profile
Code sample Java meaning C++ meaning
X x; Declares the variable x of class X. This does not creates an object Creates the object x of class X (on stack)
X x = new X(); Declares variable x and creates and assigns an object Invalid syntax
X* x; Invalid syntax Declares a pointer of type X. Same as declaring a variable in Java
X* x = new X(); Invalid syntax Declares a pointer of type X and assigns an object created (on heap)
X& x = y; Invalid syntax Declares a reference of type X and assigns another object which was previously created. A reference cannot be declared without initializing. The concept of reference does not exist in Java.
@tharinduwijewardane
tharinduwijewardane / Sample.java
Created December 29, 2018 08:40
Weka and LibSVM usage
DatabaseLoader databaseLoader = new DatabaseLoader();
String q = "SELECT news, type FROM table_name
databaseLoader.setUser("root"); // username
databaseLoader.setPassword(""); // password
databaseLoader.setQuery(q);
// load the data
Instances dataUnfiltered0 = databaseLoader.getDataSet();