Skip to content

Commit acae911

Browse files
committed
Minor cleanup in hello world example
1 parent 9f2fb5e commit acae911

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

examples/src/main/java/org/neo4j/docs/driver/HelloWorldExample.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public HelloWorldExample( String uri, String user, String password )
4141
driver = GraphDatabase.driver( uri, AuthTokens.basic( user, password ) );
4242
}
4343

44-
public static void main( String... args ) throws Exception
45-
{
46-
HelloWorldExample greeter = new HelloWorldExample( "bolt://localhost:7687", "neo4j", "password" );
47-
greeter.printGreeting( "hello, world" );
48-
}
49-
5044
@Override
5145
public void close() throws Exception
5246
{
@@ -72,6 +66,14 @@ public String execute( Transaction tx )
7266
System.out.println( greeting );
7367
}
7468
}
69+
70+
public static void main( String... args ) throws Exception
71+
{
72+
try ( HelloWorldExample greeter = new HelloWorldExample( "bolt://localhost:7687", "neo4j", "password" ) )
73+
{
74+
greeter.printGreeting( "hello, world" );
75+
}
76+
}
7577
}
7678
// end::hello-world[]
7779

0 commit comments

Comments
 (0)