{"action":"created","comment":{"url":"https://api.github.com/repos/utsabneupane/java_training/pulls/comments/22638923","id":22638923,"diff_hunk":"@@ -0,0 +1,134 @@\n+package com.lftechnology.java_training.jan7;\n+\n+import java.io.BufferedReader;\n+import java.io.FileReader;\n+import java.util.Scanner;\n+import java.util.logging.Level;\n+\n+/**\n+ * Write a program called FileInput to read an int, a double, and a String form a text file called \"in.txt\", and produce the following\n+ * output: (Hint use Scanner to read from file) a. The integer read is 12 b. The floating point number read is 33.44 c. The String read is\n+ * \"Peter\" d. Hi! Peter, the sum of 12 and 33.44 is 45.44\n+ * \n+ * @author UtsabNeupane<utsabneupane@lftechnology.com>\n+ * \n+ */\n+public class FileInput {\n+\tprivate static int[] intReadValue = new int[10];\n+\tprivate static double[] doubleReadValue = new double[10];\n+\tprivate static String[] stringReadValue = new String[10];\n+\tprivate static int intValueCounter = 0;\n+\tprivate static int doubleValueCounter = 0;\n+\tprivate static int stringValueCounter = 0;\n+\tprivate static TrainingConstantsUtility constantValues = new TrainingConstantsUtility();\n+\n+\tpublic static void main(String[] args) {\n+\t\t// read values from file\n+\t\treadFromFile();\n+\t\t// display values written in file to console\n+\t\tdisplayValueFromFile();\n+\t}\n+\n+\t/**\n+\t * read data from file and store it according to its type\n+\t */\n+\tprivate static void readFromFile() {\n+\t\tScanner inputFile = null;\n+\n+\t\ttry {\n+\t\t\tinputFile = new Scanner(new BufferedReader(new FileReader(\"in.txt\")));\n+\t\t\t// loop until the value finishes\n+\t\t\twhile (inputFile.hasNext()) {\n+\t\t\t\t// check if value is int\n+\t\t\t\tif (inputFile.hasNextInt()) {\n+\t\t\t\t\tintReadValue[intValueCounter++] = Integer.parseInt(inputFile.next());\n+\t\t\t\t\t// check if value is double\n+\t\t\t\t} else if (inputFile.hasNextDouble()) {\n+\t\t\t\t\tdoubleReadValue[doubleValueCounter++] = Double.parseDouble(inputFile.next());\n+\t\t\t\t} else {\n+\t\t\t\t\tstringReadValue[stringValueCounter++] = inputFile.next();\n+\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t} catch (Exception e) {\n+\t\t\tconstantValues.LOGGER.info(\"file not found\" + e);\n+\n+\t\t} finally {\n+\t\t\tinputFile.close();\n+\t\t}\n+\n+\t}\n+\n+\t/**\n+\t * display value stored in different variable which are according to data types\n+\t */\n+\tprivate static void displayValueFromFile() {\n+\t\tconstantValues.LOGGER\n+\t\t\t\t.log(Level.INFO,\n+\t\t\t\t\t\t\"\\na.The integer read is {0} \\nb.The doubling point number read is {1} \\nc.the string read is {2} \\nd.Hi! {3} The sum of {4}  and {5}  is {6} \",\n+\t\t\t\t\t\tnew Object[] { displayIntegerValue(), displayDoubleValue(), displayStringValue(), displayStringValue(),","path":"src/com/lftechnology/java_training/jan7/FileInput.java","position":70,"original_position":70,"commit_id":"832bca289819c691db9eb5c8532ace81472f0537","original_commit_id":"832bca289819c691db9eb5c8532ace81472f0537","user":{"login":"anishmanandhar","id":5500400,"avatar_url":"https://avatars.githubusercontent.com/u/5500400?v=3","gravatar_id":"","url":"https://api.github.com/users/anishmanandhar","html_url":"https://github.com/anishmanandhar","followers_url":"https://api.github.com/users/anishmanandhar/followers","following_url":"https://api.github.com/users/anishmanandhar/following{/other_user}","gists_url":"https://api.github.com/users/anishmanandhar/gists{/gist_id}","starred_url":"https://api.github.com/users/anishmanandhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anishmanandhar/subscriptions","organizations_url":"https://api.github.com/users/anishmanandhar/orgs","repos_url":"https://api.github.com/users/anishmanandhar/repos","events_url":"https://api.github.com/users/anishmanandhar/events{/privacy}","received_events_url":"https://api.github.com/users/anishmanandhar/received_events","type":"User","site_admin":false},"body":"here again, try not call the functions inside the logger , better to assign these function output to a variable and log that variable inside log","created_at":"2015-01-08T07:51:42Z","updated_at":"2015-01-08T07:51:42Z","html_url":"https://github.com/utsabneupane/java_training/pull/6#discussion_r22638923","pull_request_url":"https://api.github.com/repos/utsabneupane/java_training/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/comments/22638923"},"html":{"href":"https://github.com/utsabneupane/java_training/pull/6#discussion_r22638923"},"pull_request":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/utsabneupane/java_training/pulls/6","id":27009400,"html_url":"https://github.com/utsabneupane/java_training/pull/6","diff_url":"https://github.com/utsabneupane/java_training/pull/6.diff","patch_url":"https://github.com/utsabneupane/java_training/pull/6.patch","issue_url":"https://api.github.com/repos/utsabneupane/java_training/issues/6","number":6,"state":"open","locked":false,"title":"Jan7 assignment","user":{"login":"utsabneupane","id":10335354,"avatar_url":"https://avatars.githubusercontent.com/u/10335354?v=3","gravatar_id":"","url":"https://api.github.com/users/utsabneupane","html_url":"https://github.com/utsabneupane","followers_url":"https://api.github.com/users/utsabneupane/followers","following_url":"https://api.github.com/users/utsabneupane/following{/other_user}","gists_url":"https://api.github.com/users/utsabneupane/gists{/gist_id}","starred_url":"https://api.github.com/users/utsabneupane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utsabneupane/subscriptions","organizations_url":"https://api.github.com/users/utsabneupane/orgs","repos_url":"https://api.github.com/users/utsabneupane/repos","events_url":"https://api.github.com/users/utsabneupane/events{/privacy}","received_events_url":"https://api.github.com/users/utsabneupane/received_events","type":"User","site_admin":false},"body":"@leapfrog-dipendra @adhpawal @anealkeshi @anishmanandhar @bhuwang @Satish-Gupta @nerisa @bibhushanJoshi @Msanjib  this is my code assignment of jan7","created_at":"2015-01-08T06:07:25Z","updated_at":"2015-01-08T07:51:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9eff2e2099dd585ab3613908d068174c6dfd1d5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/utsabneupane/java_training/pulls/6/commits","review_comments_url":"https://api.github.com/repos/utsabneupane/java_training/pulls/6/comments","review_comment_url":"https://api.github.com/repos/utsabneupane/java_training/pulls/comments/{number}","comments_url":"https://api.github.com/repos/utsabneupane/java_training/issues/6/comments","statuses_url":"https://api.github.com/repos/utsabneupane/java_training/statuses/832bca289819c691db9eb5c8532ace81472f0537","head":{"label":"utsabneupane:jan7","ref":"jan7","sha":"832bca289819c691db9eb5c8532ace81472f0537","user":{"login":"utsabneupane","id":10335354,"avatar_url":"https://avatars.githubusercontent.com/u/10335354?v=3","gravatar_id":"","url":"https://api.github.com/users/utsabneupane","html_url":"https://github.com/utsabneupane","followers_url":"https://api.github.com/users/utsabneupane/followers","following_url":"https://api.github.com/users/utsabneupane/following{/other_user}","gists_url":"https://api.github.com/users/utsabneupane/gists{/gist_id}","starred_url":"https://api.github.com/users/utsabneupane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utsabneupane/subscriptions","organizations_url":"https://api.github.com/users/utsabneupane/orgs","repos_url":"https://api.github.com/users/utsabneupane/repos","events_url":"https://api.github.com/users/utsabneupane/events{/privacy}","received_events_url":"https://api.github.com/users/utsabneupane/received_events","type":"User","site_admin":false},"repo":{"id":28579705,"name":"java_training","full_name":"utsabneupane/java_training","owner":{"login":"utsabneupane","id":10335354,"avatar_url":"https://avatars.githubusercontent.com/u/10335354?v=3","gravatar_id":"","url":"https://api.github.com/users/utsabneupane","html_url":"https://github.com/utsabneupane","followers_url":"https://api.github.com/users/utsabneupane/followers","following_url":"https://api.github.com/users/utsabneupane/following{/other_user}","gists_url":"https://api.github.com/users/utsabneupane/gists{/gist_id}","starred_url":"https://api.github.com/users/utsabneupane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utsabneupane/subscriptions","organizations_url":"https://api.github.com/users/utsabneupane/orgs","repos_url":"https://api.github.com/users/utsabneupane/repos","events_url":"https://api.github.com/users/utsabneupane/events{/privacy}","received_events_url":"https://api.github.com/users/utsabneupane/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/utsabneupane/java_training","description":"java training","fork":false,"url":"https://api.github.com/repos/utsabneupane/java_training","forks_url":"https://api.github.com/repos/utsabneupane/java_training/forks","keys_url":"https://api.github.com/repos/utsabneupane/java_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/utsabneupane/java_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/utsabneupane/java_training/teams","hooks_url":"https://api.github.com/repos/utsabneupane/java_training/hooks","issue_events_url":"https://api.github.com/repos/utsabneupane/java_training/issues/events{/number}","events_url":"https://api.github.com/repos/utsabneupane/java_training/events","assignees_url":"https://api.github.com/repos/utsabneupane/java_training/assignees{/user}","branches_url":"https://api.github.com/repos/utsabneupane/java_training/branches{/branch}","tags_url":"https://api.github.com/repos/utsabneupane/java_training/tags","blobs_url":"https://api.github.com/repos/utsabneupane/java_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/utsabneupane/java_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/utsabneupane/java_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/utsabneupane/java_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/utsabneupane/java_training/statuses/{sha}","languages_url":"https://api.github.com/repos/utsabneupane/java_training/languages","stargazers_url":"https://api.github.com/repos/utsabneupane/java_training/stargazers","contributors_url":"https://api.github.com/repos/utsabneupane/java_training/contributors","subscribers_url":"https://api.github.com/repos/utsabneupane/java_training/subscribers","subscription_url":"https://api.github.com/repos/utsabneupane/java_training/subscription","commits_url":"https://api.github.com/repos/utsabneupane/java_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/utsabneupane/java_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/utsabneupane/java_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/utsabneupane/java_training/issues/comments/{number}","contents_url":"https://api.github.com/repos/utsabneupane/java_training/contents/{+path}","compare_url":"https://api.github.com/repos/utsabneupane/java_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/utsabneupane/java_training/merges","archive_url":"https://api.github.com/repos/utsabneupane/java_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/utsabneupane/java_training/downloads","issues_url":"https://api.github.com/repos/utsabneupane/java_training/issues{/number}","pulls_url":"https://api.github.com/repos/utsabneupane/java_training/pulls{/number}","milestones_url":"https://api.github.com/repos/utsabneupane/java_training/milestones{/number}","notifications_url":"https://api.github.com/repos/utsabneupane/java_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/utsabneupane/java_training/labels{/name}","releases_url":"https://api.github.com/repos/utsabneupane/java_training/releases{/id}","created_at":"2014-12-29T04:01:52Z","updated_at":"2014-12-30T09:46:55Z","pushed_at":"2015-01-08T06:05:43Z","git_url":"git://github.com/utsabneupane/java_training.git","ssh_url":"git@github.com:utsabneupane/java_training.git","clone_url":"https://github.com/utsabneupane/java_training.git","svn_url":"https://github.com/utsabneupane/java_training","homepage":"","size":264,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"dev"}},"base":{"label":"utsabneupane:dev","ref":"dev","sha":"eec2717ee003cb5e242c232e759ab59b307c6ffa","user":{"login":"utsabneupane","id":10335354,"avatar_url":"https://avatars.githubusercontent.com/u/10335354?v=3","gravatar_id":"","url":"https://api.github.com/users/utsabneupane","html_url":"https://github.com/utsabneupane","followers_url":"https://api.github.com/users/utsabneupane/followers","following_url":"https://api.github.com/users/utsabneupane/following{/other_user}","gists_url":"https://api.github.com/users/utsabneupane/gists{/gist_id}","starred_url":"https://api.github.com/users/utsabneupane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utsabneupane/subscriptions","organizations_url":"https://api.github.com/users/utsabneupane/orgs","repos_url":"https://api.github.com/users/utsabneupane/repos","events_url":"https://api.github.com/users/utsabneupane/events{/privacy}","received_events_url":"https://api.github.com/users/utsabneupane/received_events","type":"User","site_admin":false},"repo":{"id":28579705,"name":"java_training","full_name":"utsabneupane/java_training","owner":{"login":"utsabneupane","id":10335354,"avatar_url":"https://avatars.githubusercontent.com/u/10335354?v=3","gravatar_id":"","url":"https://api.github.com/users/utsabneupane","html_url":"https://github.com/utsabneupane","followers_url":"https://api.github.com/users/utsabneupane/followers","following_url":"https://api.github.com/users/utsabneupane/following{/other_user}","gists_url":"https://api.github.com/users/utsabneupane/gists{/gist_id}","starred_url":"https://api.github.com/users/utsabneupane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/utsabneupane/subscriptions","organizations_url":"https://api.github.com/users/utsabneupane/orgs","repos_url":"https://api.github.com/users/utsabneupane/repos","events_url":"https://api.github.com/users/utsabneupane/events{/privacy}","received_events_url":"https://api.github.com/users/utsabneupane/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/utsabneupane/java_training","description":"java training","fork":false,"url":"https://api.github.com/repos/utsabneupane/java_training","forks_url":"https://api.github.com/repos/utsabneupane/java_training/forks","keys_url":"https://api.github.com/repos/utsabneupane/java_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/utsabneupane/java_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/utsabneupane/java_training/teams","hooks_url":"https://api.github.com/repos/utsabneupane/java_training/hooks","issue_events_url":"https://api.github.com/repos/utsabneupane/java_training/issues/events{/number}","events_url":"https://api.github.com/repos/utsabneupane/java_training/events","assignees_url":"https://api.github.com/repos/utsabneupane/java_training/assignees{/user}","branches_url":"https://api.github.com/repos/utsabneupane/java_training/branches{/branch}","tags_url":"https://api.github.com/repos/utsabneupane/java_training/tags","blobs_url":"https://api.github.com/repos/utsabneupane/java_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/utsabneupane/java_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/utsabneupane/java_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/utsabneupane/java_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/utsabneupane/java_training/statuses/{sha}","languages_url":"https://api.github.com/repos/utsabneupane/java_training/languages","stargazers_url":"https://api.github.com/repos/utsabneupane/java_training/stargazers","contributors_url":"https://api.github.com/repos/utsabneupane/java_training/contributors","subscribers_url":"https://api.github.com/repos/utsabneupane/java_training/subscribers","subscription_url":"https://api.github.com/repos/utsabneupane/java_training/subscription","commits_url":"https://api.github.com/repos/utsabneupane/java_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/utsabneupane/java_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/utsabneupane/java_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/utsabneupane/java_training/issues/comments/{number}","contents_url":"https://api.github.com/repos/utsabneupane/java_training/contents/{+path}","compare_url":"https://api.github.com/repos/utsabneupane/java_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/utsabneupane/java_training/merges","archive_url":"https://api.github.com/repos/utsabneupane/java_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/utsabneupane/java_training/downloads","issues_url":"https://api.github.com/repos/utsabneupane/java_training/issues{/number}","pulls_url":"https://api.github.com/repos/utsabneupane/java_training/pulls{/number}","milestones_url":"https://api.github.com/repos/utsabneupane/java_training/milestones{/number}","notifications_url":"https://api.github.com/repos/utsabneupane/java_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/utsabneupane/java_training/labels{/name}","releases_url":"https://api.github.com/repos/utsabneupane/java_training/releases{/id}","created_at":"2014-12-29T04:01:52Z","updated_at":"2014-12-30T09:46:55Z","pushed_at":"2015-01-08T06:05:43Z","git_url":"git://github.com/utsabneupane/java_training.git","ssh_url":"git@github.com:utsabneupane/java_training.git","clone_url":"https://github.com/utsabneupane/java_training.git","svn_url":"https://github.com/utsabneupane/java_training","homepage":"","size":264,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/6"},"html":{"href":"https://github.com/utsabneupane/java_training/pull/6"},"issue":{"href":"https://api.github.com/repos/utsabneupane/java_training/issues/6"},"comments":{"href":"https://api.github.com/repos/utsabneupane/java_training/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/utsabneupane/java_training/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/utsabneupane/java_training/statuses/832bca289819c691db9eb5c8532ace81472f0537"}}}}