Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Assignment-5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Abdul Qadeer Farooqui
Assignment-5
Commits
09aa3b36
Commit
09aa3b36
authored
May 23, 2022
by
Muhammad Abdul Qadeer Farooqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made corrections in Main
parent
9dc9f5c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
29 deletions
+28
-29
workspace.xml
.idea/workspace.xml
+9
-13
Main.java
src/Main.java
+9
-10
MyThread.java
src/MyThread.java
+10
-6
No files found.
.idea/workspace.xml
View file @
09aa3b36
...
@@ -2,13 +2,9 @@
...
@@ -2,13 +2,9 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"a557173a-0c16-4d6f-82a4-07aa95bedc2f"
name=
"Changes"
comment=
""
>
<list
default=
"true"
id=
"a557173a-0c16-4d6f-82a4-07aa95bedc2f"
name=
"Changes"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/.gitignore"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/misc.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Main.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/Main.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/modules.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/MyThread.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/MyThread.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/uiDesigner.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/vcs.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/Assignment_5.iml"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -34,13 +30,13 @@
...
@@ -34,13 +30,13 @@
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
</component>
<component
name=
"PropertiesComponent"
>
<![CDATA[
{
<component
name=
"PropertiesComponent"
>
{
"keyToString"
: {
"
keyToString
"
: {
"RunOnceActivity.OpenProjectViewOnStart": "true"
,
"
RunOnceActivity.OpenProjectViewOnStart
"
:
"
true
"
,
"RunOnceActivity.ShowReadmeOnStart": "true"
,
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"SHARE_PROJECT_CONFIGURATION_FILES": "true"
"
SHARE_PROJECT_CONFIGURATION_FILES
"
:
"
true
"
}
}
}
]]>
</component>
}
</component>
<component
name=
"RunManager"
selected=
"Application.Main"
>
<component
name=
"RunManager"
selected=
"Application.Main"
>
<configuration
name=
"Main"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<configuration
name=
"Main"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"Main"
/>
<option
name=
"MAIN_CLASS_NAME"
value=
"Main"
/>
...
...
src/Main.java
View file @
09aa3b36
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
for
(
int
i
=
1
;
i
<=
2
;
i
++)
{
MyThread
t1
=
new
MyThread
(
"Thread "
+
i
);
System
.
out
.
println
(
"Main thread begins"
);
t1
.
start
();
MyThread
t1
=
new
MyThread
(
"Thread1"
);
try
{
MyThread
t2
=
new
MyThread
(
"Thread2"
);
t1
.
sleep
(
1000
);
t1
.
start
();
}
catch
(
Exception
e
)
{
t2
.
start
();
System
.
out
.
println
(
"exception"
);
t1
.
join
();
}
t2
.
join
();
}
System
.
out
.
println
(
"Main thread ends"
);
System
.
out
.
println
(
"Main thread ends"
);
}
}
}
}
src/MyThread.java
View file @
09aa3b36
...
@@ -4,13 +4,17 @@ public class MyThread extends Thread {
...
@@ -4,13 +4,17 @@ public class MyThread extends Thread {
this
.
threadName
=
threadName
;
this
.
threadName
=
threadName
;
}
}
public
void
run
()
{
public
void
run
()
{
try
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
System
.
out
.
println
(
"Thread: "
+
Thread
.
currentThread
().
getName
()
+
" is running"
);
}
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
" is running: "
+
i
);
catch
(
Exception
ex
)
{
System
.
out
.
println
(
"exception"
);
try
{
}
sleep
(
1000
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
"exception"
);
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment