content and excerpt not displaying

I figured it out myself and it worked. Here is the code if anyone need any help.

$the_query = new WP_Query('page_id=1') ;
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
        $the_query->the_post();
        the_title();
        the_content();
        the_excerpt();
    }
} else {
    // no posts found
}
wp_reset_postdata();


Edit:

This is working because the_content() and the_excerpt() have to be used within The Loop.