Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
exercises
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISC2
oop
exercises
Commits
57236a9a
Commit
57236a9a
authored
1 year ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
working
parent
c7aaf79c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
serie1/ex5.md
+47
-0
47 additions, 0 deletions
serie1/ex5.md
with
47 additions
and
0 deletions
serie1/ex5.md
0 → 100644
+
47
−
0
View file @
57236a9a
On dispose des méthodes suivantes:
```
java
void
g
(
int
n
,
float
x
)
{
...
}
void
h
(
short
s
)
{
...
}
```
Et des déclarations suivantes:
```
java
int
i
;
byte
b
;
float
f
;
double
d
;
```
Spécifiez si les appels suivants sont corrects ou non tout en justfiant vos
réponses:
```
java
g
(
i
,
f
)
// Oui, car on passe à la fonction respectivement un int et un float
// exactement comme le spécifie la signature de la fonction g
g
(
b
+
1
,
f
)
// Oui, cela fonction car car b + 1 sera implicitement converti en
//int
g
(
b
,
f
)
// Oui, cela fonctionne car le b sera implicitement converti en int
g
(
i
,
i
)
// Oui, cela fonctionne car le 2ème i sera implicitement converti en
// float
g
(
i
,
2
*
f
)
// Oui, cela va fonctionner car le 2 qui est un int sera implicitement
// converti en float
g
(
i
,
2.0
*
f
)
// Non, cela ne va pas fonctionner car 2.0 qui est un double ne
// pourra pas être implicitement converti en float
h
(
b
)
// Oui, cela va fonctionner car b sera implicitement converti en short
h
(
b
+
1
)
// Non, cela ne va pas fonctionner car b+1 sera implicitement converti en
// int cependant la fonction peut accepter uniquement un short
h
(
5
)
// Oui, cela fonctionne car 5 est dans le $D_{f}$ d'un short
h
(
5.0
)
// Non, cela ne va pas fonctionner car un double (5.0) ne peut pas être
// implicitement converti en short
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment